Class: GradesFirst::TaskToggleCommand
- Inherits:
-
TaskCommand
- Object
- Command
- TaskCommand
- GradesFirst::TaskToggleCommand
- Defined in:
- lib/gradesfirst/task_toggle_command.rb
Overview
Implementation of a Thor command for toggling whether or not a task is complete.
Class Method Summary collapse
-
.description ⇒ Object
Description of the “gf task toggle” Thor command that will be used in the commandline help.
Instance Method Summary collapse
-
#execute(position) ⇒ Object
Performs the gf task toggle POSITION Thor command.
-
#response ⇒ Object
Generates the command line output response.
Class Method Details
.description ⇒ Object
Description of the “gf task toggle” Thor command that will be used in the commandline help.
10 11 12 |
# File 'lib/gradesfirst/task_toggle_command.rb', line 10 def self.description 'Toggle completion status of a PivotalTracker story task.' end |
Instance Method Details
#execute(position) ⇒ Object
Performs the gf task toggle POSITION Thor command.
15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/gradesfirst/task_toggle_command.rb', line 15 def execute(position) @story = current_story if @story task = get_task_by_position(@story, position) if task @success = task_toggle(@story, task) else @task_position_invalid = true end end end |
#response ⇒ Object
Generates the command line output response. The output of the task toggle command is a completion status message which may be followed by the new list of tasks if the task was moved successfully.
30 31 32 33 34 35 36 |
# File 'lib/gradesfirst/task_toggle_command.rb', line 30 def response if @task_position_invalid else task_action_response(@story, @success) end end |