Class: PHPRB::Compiler::Buffer

Inherits:
Object
  • Object
show all
Defined in:
lib/web/phprb.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(compiler) ⇒ Buffer

Returns a new instance of Buffer.



258
259
260
261
262
263
264
265
# File 'lib/web/phprb.rb', line 258

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.



266
267
268
# File 'lib/web/phprb.rb', line 266

def script
  @script
end

Instance Method Details

#closeObject



278
279
280
281
282
283
284
285
# File 'lib/web/phprb.rb', line 278

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

#crObject



272
273
274
275
276
# File 'lib/web/phprb.rb', line 272

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

#push(cmd) ⇒ Object



268
269
270
# File 'lib/web/phprb.rb', line 268

def push(cmd)
	@line << cmd
end