Class: PrefixedIO

Inherits:
Delegator
  • Object
show all
Defined in:
lib/mkbrut/prefixed_io.rb

Instance Method Summary collapse

Constructor Details

#initialize(io, prefix) ⇒ PrefixedIO

Returns a new instance of PrefixedIO.



3
4
5
6
# File 'lib/mkbrut/prefixed_io.rb', line 3

def initialize(io, prefix)
  @io     = io
  @prefix = "[ #{prefix} ] "
end

Instance Method Details

#__getobj__Object



8
# File 'lib/mkbrut/prefixed_io.rb', line 8

def __getobj__ = @io

#puts(*args) ⇒ Object



10
11
12
13
14
# File 'lib/mkbrut/prefixed_io.rb', line 10

def puts(*args)
  args.each do |arg|
    @io.puts(@prefix + arg.to_s)
  end
end