Class: Console::Buffer

Inherits:
StringIO
  • Object
show all
Defined in:
lib/console/buffer.rb

Instance Method Summary collapse

Constructor Details

#initialize(prefix = nil) ⇒ Buffer

Returns a new instance of Buffer.



25
26
27
28
29
# File 'lib/console/buffer.rb', line 25

def initialize(prefix = nil)
	@prefix = prefix
	
	super()
end

Instance Method Details

#puts(*args, prefix: @prefix) ⇒ Object Also known as: <<



31
32
33
34
35
36
# File 'lib/console/buffer.rb', line 31

def puts(*args, prefix: @prefix)
	args.each do |arg|
		self.write(prefix) if prefix
		super(arg)
	end
end