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.



462
463
464
465
466
467
468
469
# File 'lib/erb.rb', line 462

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



470
471
472
# File 'lib/erb.rb', line 470

def script
  @script
end

Instance Method Details

#closeObject



482
483
484
485
486
487
488
489
# File 'lib/erb.rb', line 482

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

#crObject



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

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

#push(cmd) ⇒ Object



472
473
474
# File 'lib/erb.rb', line 472

def push(cmd)
	@line << cmd
end