Class: TempestTime::Commands::Track
- Inherits:
-
TempestTime::Command
- Object
- TempestTime::Command
- TempestTime::Commands::Track
- Defined in:
- lib/tempest_time/commands/track.rb
Instance Attribute Summary collapse
-
#issues ⇒ Object
readonly
Returns the value of attribute issues.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#time ⇒ Object
readonly
Returns the value of attribute time.
-
#user ⇒ Object
readonly
Returns the value of attribute user.
Instance Method Summary collapse
- #execute! ⇒ Object
-
#initialize(time, issues, options) ⇒ Track
constructor
A new instance of Track.
Methods inherited from TempestTime::Command
#command, #current_user, #date_prompt, #execute, #find_user, #pastel, #prompt, #spinner, #table, #week_prompt, #with_spinner, #with_success_fail_spinner
Methods included from Helpers::GitHelper
Methods included from Helpers::FormattingHelper
Methods included from Helpers::TimeHelper
#beginning_of_week, #dates_in_range, #end_of_week, #formatted_date, #formatted_date_range, #formatted_time, #formatted_time_for_input, #formatted_time_long, #future_dates, #parsed_time, #past_dates, #past_week_selections, #week_beginnings, #week_dates
Constructor Details
#initialize(time, issues, options) ⇒ Track
Returns a new instance of Track.
12 13 14 15 16 17 18 |
# File 'lib/tempest_time/commands/track.rb', line 12 def initialize(time, issues, ) @options = @issues = issues.any? ? issues.map(&:upcase) : [automatic_issue] @time = parsed_time(time) / @issues.count @dates = [:date] ? [Date.parse([:date])] : nil @user = current_user end |
Instance Attribute Details
#issues ⇒ Object (readonly)
Returns the value of attribute issues.
10 11 12 |
# File 'lib/tempest_time/commands/track.rb', line 10 def issues @issues end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
10 11 12 |
# File 'lib/tempest_time/commands/track.rb', line 10 def @options end |
#time ⇒ Object (readonly)
Returns the value of attribute time.
10 11 12 |
# File 'lib/tempest_time/commands/track.rb', line 10 def time @time end |
#user ⇒ Object (readonly)
Returns the value of attribute user.
10 11 12 |
# File 'lib/tempest_time/commands/track.rb', line 10 def user @user end |
Instance Method Details
#execute! ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/tempest_time/commands/track.rb', line 20 def execute! dates unless [:autoconfirm] confirm_prompt end dates.each do |date| issues.each do |issue| track_time(time, .merge({ issue: issue, date: date, user: user })) end end end |