Class: Battlestation::UI::Shell
- Inherits:
-
Battlestation::UI
- Object
- Battlestation::UI
- Battlestation::UI::Shell
- Defined in:
- lib/battlestation/ui.rb
Instance Attribute Summary collapse
-
#shell ⇒ Object
writeonly
Sets the attribute shell.
Instance Method Summary collapse
- #be_quiet! ⇒ Object
- #confirm(message, newline = nil) ⇒ Object
- #debug(message, newline = nil) ⇒ Object
- #debug! ⇒ Object
- #debug? ⇒ Boolean
- #error(message, newline = nil) ⇒ Object
- #fail(message, newline = nil) ⇒ Object
- #group(title, &block) ⇒ Object
- #info(message, newline = nil) ⇒ Object
-
#initialize(shell) ⇒ Shell
constructor
A new instance of Shell.
- #notice(message, newline = nil) ⇒ Object
- #okay(message, newline = nil) ⇒ Object
- #todo(message, newline = nil) ⇒ Object
- #warn(message, newline = nil) ⇒ Object
Constructor Details
#initialize(shell) ⇒ Shell
Returns a new instance of Shell.
39 40 41 42 |
# File 'lib/battlestation/ui.rb', line 39 def initialize(shell) @shell = shell @quiet = false end |
Instance Attribute Details
#shell=(value) ⇒ Object (writeonly)
Sets the attribute shell
37 38 39 |
# File 'lib/battlestation/ui.rb', line 37 def shell=(value) @shell = value end |
Instance Method Details
#be_quiet! ⇒ Object
95 96 97 |
# File 'lib/battlestation/ui.rb', line 95 def be_quiet! @quiet = true end |
#confirm(message, newline = nil) ⇒ Object
83 84 85 |
# File 'lib/battlestation/ui.rb', line 83 def confirm(, newline = nil) tell_me(, :green, newline) if !@quiet end |
#debug(message, newline = nil) ⇒ Object
71 72 73 |
# File 'lib/battlestation/ui.rb', line 71 def debug(, newline = nil) tell_me(, nil, newline) if debug? end |
#debug! ⇒ Object
91 92 93 |
# File 'lib/battlestation/ui.rb', line 91 def debug! @debug = true end |
#debug? ⇒ Boolean
87 88 89 |
# File 'lib/battlestation/ui.rb', line 87 def debug? !!@debug && !@quiet end |
#error(message, newline = nil) ⇒ Object
75 76 77 |
# File 'lib/battlestation/ui.rb', line 75 def error(, newline = nil) tell_me(, :red, newline) end |
#fail(message, newline = nil) ⇒ Object
55 56 57 |
# File 'lib/battlestation/ui.rb', line 55 def fail(, newline = nil) tell_me(" [FAIL] #{}", :red, newline) end |
#group(title, &block) ⇒ Object
44 45 46 47 48 49 |
# File 'lib/battlestation/ui.rb', line 44 def group(title, &block) tell_me("> #{title}") tell_me("\n") yield tell_me("\n") end |
#info(message, newline = nil) ⇒ Object
79 80 81 |
# File 'lib/battlestation/ui.rb', line 79 def info(, newline = nil) tell_me(, nil, newline) if !@quiet end |
#notice(message, newline = nil) ⇒ Object
59 60 61 |
# File 'lib/battlestation/ui.rb', line 59 def notice(, newline = nil) tell_me(" [INFO] #{}", :blue, newline) end |
#okay(message, newline = nil) ⇒ Object
63 64 65 |
# File 'lib/battlestation/ui.rb', line 63 def okay(, newline = nil) tell_me(" [OKAY] #{}", :green, newline) end |
#todo(message, newline = nil) ⇒ Object
51 52 53 |
# File 'lib/battlestation/ui.rb', line 51 def todo(, newline = nil) tell_me(" [TODO] #{}", :cyan, newline) end |
#warn(message, newline = nil) ⇒ Object
67 68 69 |
# File 'lib/battlestation/ui.rb', line 67 def warn(, newline = nil) tell_me(" [WARN] #{}", :yellow, newline) end |