Class: ERB::Compiler::Buffer

Inherits:
Object
  • Object
show all
Defined in:
lib/missing/erb.rb

Overview

:nodoc:

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(compiler, enc = nil) ⇒ Buffer

Returns a new instance of Buffer.



280
281
282
283
284
285
286
287
# File 'lib/missing/erb.rb', line 280

def initialize(compiler, enc=nil)
  @compiler = compiler
  @line = []
  @script = enc ? "#coding:#{enc.to_s}\n" : ""
  @compiler.pre_cmd.each do |x|
    push(x)
  end
end

Instance Attribute Details

#scriptObject (readonly)

Returns the value of attribute script.



288
289
290
# File 'lib/missing/erb.rb', line 288

def script
  @script
end

Instance Method Details

#closeObject



300
301
302
303
304
305
306
307
# File 'lib/missing/erb.rb', line 300

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

#crObject



294
295
296
297
298
# File 'lib/missing/erb.rb', line 294

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

#push(cmd) ⇒ Object



290
291
292
# File 'lib/missing/erb.rb', line 290

def push(cmd)
  @line << cmd
end