Class: Neetob::CLI::UI
- Inherits:
-
Object
- Object
- Neetob::CLI::UI
- Defined in:
- lib/neetob/cli/ui.rb
Instance Attribute Summary collapse
-
#shell ⇒ Object
Returns the value of attribute shell.
Instance Method Summary collapse
- #ask(question, echo = true) ⇒ Object
- #error(statement) ⇒ Object
- #info(statement) ⇒ Object
-
#initialize ⇒ UI
constructor
A new instance of UI.
- #say(statement, color = Thor::Shell::Color::YELLOW) ⇒ Object
- #success(statement) ⇒ Object
- #yes?(question) ⇒ Boolean
Constructor Details
#initialize ⇒ UI
Returns a new instance of UI.
12 13 14 |
# File 'lib/neetob/cli/ui.rb', line 12 def initialize @shell = Thor::Base.shell.new end |
Instance Attribute Details
#shell ⇒ Object
Returns the value of attribute shell.
10 11 12 |
# File 'lib/neetob/cli/ui.rb', line 10 def shell @shell end |
Instance Method Details
#ask(question, echo = true) ⇒ Object
20 21 22 |
# File 'lib/neetob/cli/ui.rb', line 20 def ask(question, echo = true) shell.ask(question, echo:) end |
#error(statement) ⇒ Object
28 29 30 |
# File 'lib/neetob/cli/ui.rb', line 28 def error(statement) shell.say(statement, Thor::Shell::Color::RED) end |
#info(statement) ⇒ Object
36 37 38 |
# File 'lib/neetob/cli/ui.rb', line 36 def info(statement) shell.say(statement) end |
#say(statement, color = Thor::Shell::Color::YELLOW) ⇒ Object
16 17 18 |
# File 'lib/neetob/cli/ui.rb', line 16 def say(statement, color = Thor::Shell::Color::YELLOW) shell.say(statement, color) end |
#success(statement) ⇒ Object
32 33 34 |
# File 'lib/neetob/cli/ui.rb', line 32 def success(statement) shell.say(statement, Thor::Shell::Color::GREEN) end |
#yes?(question) ⇒ Boolean
24 25 26 |
# File 'lib/neetob/cli/ui.rb', line 24 def yes?(question) shell.yes?(question) end |