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/compiler.rb

Class Method Summary

Instance Attribute Summary

Instance Method Summary

Constructor Details

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

[ GitHub ]

  
# File 'lib/erb/compiler.rb', line 273

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/compiler.rb', line 283

attr_reader :script

Instance Method Details

#close

[ GitHub ]

  
# File 'lib/erb/compiler.rb', line 295

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/compiler.rb', line 289

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

#push(cmd)

[ GitHub ]

  
# File 'lib/erb/compiler.rb', line 285

def push(cmd)
  @line << cmd
end