Class: Tipjoy::Logger

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(on = false) ⇒ Logger

Returns a new instance of Logger.



19
20
21
# File 'lib/tipjoy.rb', line 19

def initialize(on=false)
  self.on = on
end

Instance Attribute Details

#onObject

Returns the value of attribute on.



17
18
19
# File 'lib/tipjoy.rb', line 17

def on
  @on
end

Instance Method Details

#error(msg) ⇒ Object



27
28
29
# File 'lib/tipjoy.rb', line 27

def error(msg)
  info(msg)
end

#info(msg) ⇒ Object



31
32
33
# File 'lib/tipjoy.rb', line 31

def info(msg)
  puts msg if self.on?
end

#on?Boolean

Returns:

  • (Boolean)


35
36
37
# File 'lib/tipjoy.rb', line 35

def on?
  self.on
end

#warn(msg) ⇒ Object



23
24
25
# File 'lib/tipjoy.rb', line 23

def warn(msg)
  info(msg)
end