Class: Conveyor::Output::Console
- Inherits:
-
Object
- Object
- Conveyor::Output::Console
- Defined in:
- lib/conveyor/output/console.rb
Class Method Summary collapse
- .error(*msg) ⇒ Object
- .output(*msg) ⇒ Object (also: info, debug)
- .warning(*msg) ⇒ Object
- .write(msgtype, *msg) ⇒ Object
Class Method Details
.error(*msg) ⇒ Object
36 37 38 39 40 41 |
# File 'lib/conveyor/output/console.rb', line 36 def error(*msg) = msg. [:color] ||= :red msg.flatten! output(*msg, ) end |
.output(*msg) ⇒ Object Also known as: info, debug
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/conveyor/output/console.rb', line 11 def output(*msg) = msg. [:color] ||= :default [:tab] ||= 0 format = "\t"*[:tab] format << "\r[%s] %s" if msg.class == Array msg.each do |m| puts sprintf(format, Time.now, m).color([:color]) end else puts sprintf(format, Time.now, msg).color([:color]) end end |
.warning(*msg) ⇒ Object
29 30 31 32 33 34 |
# File 'lib/conveyor/output/console.rb', line 29 def warning(*msg) = msg. [:color] ||= :yellow msg.flatten! output(*msg, ) end |
.write(msgtype, *msg) ⇒ Object
5 6 7 8 9 |
# File 'lib/conveyor/output/console.rb', line 5 def write(msgtype, *msg) if respond_to?(msgtype) self.send(msgtype, *msg) end end |