Sha256: 64fe3a306d5bf3ecc25c5b8656b2e9f7b3cd4dbfc29830c9dca2ec28ed8e0f0a
Contents?: true
Size: 1.31 KB
Versions: 10
Compression:
Stored size: 1.31 KB
Contents
module Redpomo class UI def warn(message, newline = nil) end def debug(message, newline = nil) end def error(message, newline = nil) end def info(message, newline = nil) end def confirm(message, newline = nil) end def debug? false end class Shell < UI attr_writer :shell def initialize(shell) @shell = shell @quiet = false @debug = ENV['DEBUG'] end def info(msg, newline = nil) tell_me(msg, nil, newline) if !@quiet end def confirm(msg, newline = nil) tell_me(msg, :green, newline) if !@quiet end def warn(msg, newline = nil) tell_me(msg, :yellow, newline) end def error(msg, newline = nil) tell_me(msg, :red, newline) end def be_quiet! @quiet = true end def debug? # needs to be false instead of nil to be newline param to other methods !!@debug && !@quiet end def debug! @debug = true end def debug(msg, newline = nil) tell_me(msg, nil, newline) if debug? end private # valimism def tell_me(msg, color = nil, newline = nil) newline.nil? ? @shell.say(msg, color) : @shell.say(msg, color, newline) end end end end
Version data entries
10 entries across 10 versions & 2 rubygems