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.



490
491
492
493
494
495
496
497
# File 'lib/erb.rb', line 490

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.



498
499
500
# File 'lib/erb.rb', line 498

def script
  @script
end

Instance Method Details

#closeObject



510
511
512
513
514
515
516
517
# File 'lib/erb.rb', line 510

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

#crObject



504
505
506
507
508
# File 'lib/erb.rb', line 504

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

#push(cmd) ⇒ Object



500
501
502
# File 'lib/erb.rb', line 500

def push(cmd)
	@line << cmd
end