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.



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

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.



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

def script
  @script
end

Instance Method Details

#closeObject



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

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

#crObject



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

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

#push(cmd) ⇒ Object



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

def push(cmd)
	@line << cmd
end