Class: TempestTime::Commands::Delete
- Inherits:
-
TempestTime::Command
- Object
- TempestTime::Command
- TempestTime::Commands::Delete
- Defined in:
- lib/tempest_time/commands/delete.rb
Instance Method Summary collapse
- #execute(input: $stdin, output: $stdout) ⇒ Object
-
#initialize(worklogs, options) ⇒ Delete
constructor
A new instance of Delete.
Methods inherited from TempestTime::Command
#command, #pastel, #prompt, #spinner, #table, #with_spinner, #with_success_fail_spinner
Constructor Details
#initialize(worklogs, options) ⇒ Delete
Returns a new instance of Delete.
9 10 11 12 |
# File 'lib/tempest_time/commands/delete.rb', line 9 def initialize(worklogs, ) @worklogs = worklogs @options = end |
Instance Method Details
#execute(input: $stdin, output: $stdout) ⇒ Object
14 15 16 17 18 19 20 |
# File 'lib/tempest_time/commands/delete.rb', line 14 def execute(input: $stdin, output: $stdout) pluralized = @worklogs.length > 1 ? 'worklogs' : 'worklog' = "Delete #{pluralized} #{pastel.green(@worklogs.join(', '))}?" abort unless prompt.yes?() @worklogs.each { |worklog| delete_worklog(worklog) } end |