Class: Saber::UI
- Inherits:
-
Object
- Object
- Saber::UI
- Defined in:
- lib/saber/ui.rb
Defined Under Namespace
Instance Method Summary collapse
- #be_quiet! ⇒ Object
- #confirm(msg) ⇒ Object
- #debug(msg) ⇒ Object
- #debug! ⇒ Object
- #error(msg) ⇒ Object
-
#error!(msg) ⇒ Object
error with exit.
- #info(msg) ⇒ Object
-
#initialize ⇒ UI
constructor
A new instance of UI.
- #say(msg) ⇒ Object
- #warn(msg) ⇒ Object
Constructor Details
#initialize ⇒ UI
Returns a new instance of UI.
3 4 5 6 |
# File 'lib/saber/ui.rb', line 3 def initialize @quiet = false @debug = ENV["DEBUG"] end |
Instance Method Details
#be_quiet! ⇒ Object
38 39 40 |
# File 'lib/saber/ui.rb', line 38 def be_quiet! @quiet = true end |
#confirm(msg) ⇒ Object
30 31 32 |
# File 'lib/saber/ui.rb', line 30 def confirm(msg) do_confirm(msg) if !@quiet end |
#debug(msg) ⇒ Object
12 13 14 |
# File 'lib/saber/ui.rb', line 12 def debug(msg) do_debug(msg) if @debug && !@quiet end |
#debug! ⇒ Object
42 43 44 |
# File 'lib/saber/ui.rb', line 42 def debug! @debug = true end |
#error(msg) ⇒ Object
20 21 22 |
# File 'lib/saber/ui.rb', line 20 def error(msg) do_error(msg) end |
#error!(msg) ⇒ Object
error with exit
25 26 27 28 |
# File 'lib/saber/ui.rb', line 25 def error!(msg) error(msg) exit 1 end |
#info(msg) ⇒ Object
8 9 10 |
# File 'lib/saber/ui.rb', line 8 def info(msg) do_info(msg) if !@quiet end |
#say(msg) ⇒ Object
34 35 36 |
# File 'lib/saber/ui.rb', line 34 def say(msg) info(msg) end |
#warn(msg) ⇒ Object
16 17 18 |
# File 'lib/saber/ui.rb', line 16 def warn(msg) do_warn(msg) end |