Class: Duty::CLI::View
- Inherits:
-
Object
- Object
- Duty::CLI::View
- Defined in:
- lib/duty/cli.rb
Direct Known Subclasses
Instance Method Summary collapse
- #command_failure(command) ⇒ Object
- #command_success(command) ⇒ Object
-
#initialize(output) ⇒ View
constructor
A new instance of View.
- #task_explain(task) ⇒ Object
- #task_failure(task) ⇒ Object
- #task_success(task) ⇒ Object
Constructor Details
#initialize(output) ⇒ View
Returns a new instance of View.
135 136 137 |
# File 'lib/duty/cli.rb', line 135 def initialize(output) @output = output end |
Instance Method Details
#command_failure(command) ⇒ Object
163 164 165 166 |
# File 'lib/duty/cli.rb', line 163 def command_failure(command) description = command.description failure(description) end |
#command_success(command) ⇒ Object
158 159 160 161 |
# File 'lib/duty/cli.rb', line 158 def command_success(command) description = command.description success(description) end |
#task_explain(task) ⇒ Object
139 140 141 142 143 144 145 146 |
# File 'lib/duty/cli.rb', line 139 def task_explain(task) task_class = task.class description = task_class.description usage = task_class.usage @output.print(description) @output.print(usage) end |
#task_failure(task) ⇒ Object
153 154 155 156 |
# File 'lib/duty/cli.rb', line 153 def task_failure(task) task_name = task.class.name failure("#{task_name} task aborted") end |
#task_success(task) ⇒ Object
148 149 150 151 |
# File 'lib/duty/cli.rb', line 148 def task_success(task) task_name = task.class.name success("#{task_name} task executed") end |