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.



456
457
458
459
460
461
462
463
# File 'lib/erb.rb', line 456

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



464
465
466
# File 'lib/erb.rb', line 464

def script
  @script
end

Instance Method Details

#closeObject



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

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

#crObject



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

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

#push(cmd) ⇒ Object



466
467
468
# File 'lib/erb.rb', line 466

def push(cmd)
	@line << cmd
end