Class: TempestTime::Commands::Track
- Inherits:
-
TempestTime::Command
- Object
- TempestTime::Command
- TempestTime::Commands::Track
- Includes:
- Helpers::TimeHelper
- Defined in:
- lib/tempest_time/commands/track.rb
Instance Method Summary collapse
- #execute(input: $stdin, output: $stdout) ⇒ Object
-
#initialize(time, tickets, options) ⇒ Track
constructor
A new instance of Track.
Methods included from Helpers::TimeHelper
#beginning_of_this_week, #beginning_of_week, #formatted_date, #formatted_date_range, #formatted_time, #parsed_date_input, #parsed_time, #this_week
Methods inherited from TempestTime::Command
#command, #pastel, #prompt, #spinner, #table, #with_spinner, #with_success_fail_spinner
Constructor Details
#initialize(time, tickets, options) ⇒ Track
Returns a new instance of Track.
14 15 16 17 18 |
# File 'lib/tempest_time/commands/track.rb', line 14 def initialize(time, tickets, ) @time = time @tickets = tickets @options = end |
Instance Method Details
#execute(input: $stdin, output: $stdout) ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/tempest_time/commands/track.rb', line 20 def execute(input: $stdin, output: $stdout) time = @options[:split] ? parsed_time(@time) / @tickets.count : parsed_time(@time) tickets = @tickets.any? ? @tickets.map(&:upcase) : [automatic_ticket] = "Track #{formatted_time(time)}, "\ "#{billability(@options)}, "\ "to #{tickets.join(', ')}?" abort unless prompt.yes?(, convert: :bool) tickets.each do |ticket| track_time(time, @options.merge(ticket: ticket)) end end |