Class: Redpomo::UI::Shell
- Inherits:
-
Redpomo::UI
- Object
- Redpomo::UI
- Redpomo::UI::Shell
- Defined in:
- lib/redpomo/ui.rb
Instance Attribute Summary collapse
-
#shell ⇒ Object
writeonly
Sets the attribute shell.
Instance Method Summary collapse
- #be_quiet! ⇒ Object
- #confirm(msg, newline = nil) ⇒ Object
- #debug(msg, newline = nil) ⇒ Object
- #debug! ⇒ Object
- #debug? ⇒ Boolean
- #error(msg, newline = nil) ⇒ Object
- #info(msg, newline = nil) ⇒ Object
-
#initialize(shell) ⇒ Shell
constructor
A new instance of Shell.
- #warn(msg, newline = nil) ⇒ Object
Constructor Details
#initialize(shell) ⇒ Shell
Returns a new instance of Shell.
26 27 28 29 30 |
# File 'lib/redpomo/ui.rb', line 26 def initialize(shell) @shell = shell @quiet = false @debug = ENV['DEBUG'] end |
Instance Attribute Details
#shell=(value) ⇒ Object (writeonly)
Sets the attribute shell
24 25 26 |
# File 'lib/redpomo/ui.rb', line 24 def shell=(value) @shell = value end |
Instance Method Details
#be_quiet! ⇒ Object
48 49 50 |
# File 'lib/redpomo/ui.rb', line 48 def be_quiet! @quiet = true end |
#confirm(msg, newline = nil) ⇒ Object
36 37 38 |
# File 'lib/redpomo/ui.rb', line 36 def confirm(msg, newline = nil) tell_me(msg, :green, newline) if !@quiet end |
#debug(msg, newline = nil) ⇒ Object
61 62 63 |
# File 'lib/redpomo/ui.rb', line 61 def debug(msg, newline = nil) tell_me(msg, nil, newline) if debug? end |
#debug! ⇒ Object
57 58 59 |
# File 'lib/redpomo/ui.rb', line 57 def debug! @debug = true end |
#debug? ⇒ Boolean
52 53 54 55 |
# File 'lib/redpomo/ui.rb', line 52 def debug? # needs to be false instead of nil to be newline param to other methods !!@debug && !@quiet end |
#error(msg, newline = nil) ⇒ Object
44 45 46 |
# File 'lib/redpomo/ui.rb', line 44 def error(msg, newline = nil) tell_me(msg, :red, newline) end |
#info(msg, newline = nil) ⇒ Object
32 33 34 |
# File 'lib/redpomo/ui.rb', line 32 def info(msg, newline = nil) tell_me(msg, nil, newline) if !@quiet end |
#warn(msg, newline = nil) ⇒ Object
40 41 42 |
# File 'lib/redpomo/ui.rb', line 40 def warn(msg, newline = nil) tell_me(msg, :yellow, newline) end |