Class: ERB::Compiler::Buffer

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

Overview

:nodoc:

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(compiler) ⇒ Buffer

Returns a new instance of Buffer.



474
475
476
477
478
479
480
481
# File 'lib/erb.rb', line 474

def initialize(compiler)
  @compiler = compiler
  @line = []
  @script = ""
  @compiler.pre_cmd.each do |x|
    push(x)
  end
end

Instance Attribute Details

#scriptObject (readonly)

Returns the value of attribute script.



482
483
484
# File 'lib/erb.rb', line 482

def script
  @script
end

Instance Method Details

#closeObject



494
495
496
497
498
499
500
501
# File 'lib/erb.rb', line 494

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

#crObject



488
489
490
491
492
# File 'lib/erb.rb', line 488

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

#push(cmd) ⇒ Object



484
485
486
# File 'lib/erb.rb', line 484

def push(cmd)
  @line << cmd
end