Sha256: ff5d97adf19206580fdff2281a7d9ab5d90bc7e76a054d6e9f0a9443e8393b85
Contents?: true
Size: 1.14 KB
Versions: 11
Compression:
Stored size: 1.14 KB
Contents
module Conveyor module Output class Console class << self def write(msgtype, *msg) if respond_to?(msgtype) self.send(msgtype, *msg) end end def output(*msg) options = msg.extract_options! options[:color] ||= :default options[:tab] ||= 0 format = "\t"*options[:tab] format << "\r[%s] %s" if msg.class == Array msg.each do |m| puts sprintf(format, Time.now, m).color(options[:color]) end else puts sprintf(format, Time.now, msg).color(options[:color]) end end alias_method :info, :output alias_method :debug, :output def warning(*msg) options = msg.extract_options! options[:color] ||= :yellow msg.flatten! output(*msg, options) end def error(*msg) options = msg.extract_options! options[:color] ||= :red msg.flatten! output(*msg, options) end end end end end
Version data entries
11 entries across 11 versions & 1 rubygems