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.



27
28
29
30
31
# File 'lib/console/buffer.rb', line 27

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

Instance Method Details

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



33
34
35
36
37
38
# File 'lib/console/buffer.rb', line 33

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