Class: Tempster::Messager

Inherits:
Object show all
Defined in:
lib/tempster.rb

Instance Method Summary collapse

Constructor Details

#initialize(verbose, callback = nil, prefix = "") ⇒ Messager

Returns a new instance of Messager.



172
173
174
175
176
# File 'lib/tempster.rb', line 172

def initialize(verbose, callback=nil, prefix="")
  @verbose = verbose
  @callback = callback
  @prefix = prefix
end

Instance Method Details

#puts(message) ⇒ Object



178
179
180
181
182
183
184
185
186
# File 'lib/tempster.rb', line 178

def puts(message)
  if @callback
    @callback.call(@prefix+message)
  else
    if @verbose
      STDOUT.puts @prefix+message
    end
  end
end