123456789_123456789_123456789_123456789_123456789_

Class: ERB::Compiler::Buffer

Do not use. This class is for internal use only.
Relationships & Source Files
Inherits: Object
Defined in: lib/erb.rb

Class Method Summary

Instance Attribute Summary

Instance Method Summary

Constructor Details

.new(compiler, enc = nil, frozen = nil) ⇒ Buffer

[ GitHub ]

  
# File 'lib/erb.rb', line 543

def initialize(compiler, enc=nil, frozen=nil)
  @compiler = compiler
  @line = []
  @script = +''
  @script << "#coding:#{enc}\n" if enc
  @script << "#frozen-string-literal:#{frozen}\n" unless frozen.nil?
  @compiler.pre_cmd.each do |x|
    push(x)
  end
end

Instance Attribute Details

#script (readonly)

[ GitHub ]

  
# File 'lib/erb.rb', line 553

attr_reader :script

Instance Method Details

#close

[ GitHub ]

  
# File 'lib/erb.rb', line 565

def close
  return unless @line
  @compiler.post_cmd.each do |x|
    push(x)
  end
  @script << (@line.join('; '))
  @line = nil
end

#cr

[ GitHub ]

  
# File 'lib/erb.rb', line 559

def cr
  @script << (@line.join('; '))
  @line = []
  @script << "\n"
end

#push(cmd)

[ GitHub ]

  
# File 'lib/erb.rb', line 555

def push(cmd)
  @line << cmd
end