module Printer

Public Class Methods

ask(msg) click to toggle source
# File lib/flickru/printer.rb, line 40
def self.ask msg
  puts ("*** " + msg + " ***").light_blue
end
enter(msg) click to toggle source
# File lib/flickru/printer.rb, line 36
def self.enter msg
  print (">>> " + msg + ": ").black
end
error(msg) click to toggle source
# File lib/flickru/printer.rb, line 32
def self.error msg
  STDERR.puts msg.red
end
failure(msg=nil) click to toggle source
# File lib/flickru/printer.rb, line 48
def self.failure msg=nil
  puts ("fail" + (msg.nil? ? "" : ": " + msg)).red
end
human_readable_seconds(seconds) click to toggle source
# File lib/flickru/printer.rb, line 8
def self.human_readable_seconds seconds
  Ruby.assert("seconds >= 0") { seconds >= 0 }

  return "%.1f" % seconds + " seconds" if seconds < 60
  minutes  = seconds / 60
  return "%.1f" % minutes + " minutes" if minutes < 60
  hours    = minutes / 60
  return "%.1f" % hours   + " hours"   if hours   < 24
  days     = hours / 24
  return "%.1f" % days    + " days"
end
info(msg) click to toggle source
# File lib/flickru/printer.rb, line 24
def self.info msg
  puts msg.cyan
end
show(msg) click to toggle source
# File lib/flickru/printer.rb, line 20
def self.show msg
  print msg
end
success() click to toggle source
# File lib/flickru/printer.rb, line 44
def self.success
  puts "done".green
end
warn(msg) click to toggle source
# File lib/flickru/printer.rb, line 28
def self.warn msg
  puts ("warning: " + msg).magenta
end