Class: ERB::Compiler::Buffer

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

Overview

:nodoc:

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(compiler, enc = nil) ⇒ Buffer

Returns a new instance of Buffer.



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

def initialize(compiler, enc=nil)
	@compiler = compiler
	@line = []
  @script = enc ? "#coding:#{enc.to_s}\n" : ""
	@compiler.pre_cmd.each do |x|
	  push(x)
	end
end

Instance Attribute Details

#scriptObject (readonly)

Returns the value of attribute script.



517
518
519
# File 'lib/framework/erb.rb', line 517

def script
  @script
end

Instance Method Details

#closeObject



529
530
531
532
533
534
535
536
# File 'lib/framework/erb.rb', line 529

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

#crObject



523
524
525
526
527
# File 'lib/framework/erb.rb', line 523

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

#push(cmd) ⇒ Object



519
520
521
# File 'lib/framework/erb.rb', line 519

def push(cmd)
	@line << cmd
end