Class: Jira::Auto::Tool::Performer::SprintTimeInDatesAligner
- Defined in:
- lib/jira/auto/tool/performer/sprint_time_in_dates_aligner.rb
Instance Attribute Summary collapse
-
#sprint_time_in_dates ⇒ Object
readonly
Returns the value of attribute sprint_time_in_dates.
-
#tool ⇒ Object
readonly
Returns the value of attribute tool.
Instance Method Summary collapse
-
#initialize(tool, sprint_time_in_dates) ⇒ SprintTimeInDatesAligner
constructor
A new instance of SprintTimeInDatesAligner.
- #run ⇒ Object
- #update_sprint_dates_for(sprint) ⇒ Object
- #update_sprint_dates_with_expected_time ⇒ Object
Constructor Details
#initialize(tool, sprint_time_in_dates) ⇒ SprintTimeInDatesAligner
Returns a new instance of SprintTimeInDatesAligner.
12 13 14 15 16 17 18 19 20 |
# File 'lib/jira/auto/tool/performer/sprint_time_in_dates_aligner.rb', line 12 def initialize(tool, sprint_time_in_dates) @tool = tool @sprint_time_in_dates = if sprint_time_in_dates.is_a?(String) Time.parse(sprint_time_in_dates) else sprint_time_in_dates end end |
Instance Attribute Details
#sprint_time_in_dates ⇒ Object (readonly)
Returns the value of attribute sprint_time_in_dates.
10 11 12 |
# File 'lib/jira/auto/tool/performer/sprint_time_in_dates_aligner.rb', line 10 def sprint_time_in_dates @sprint_time_in_dates end |
#tool ⇒ Object (readonly)
Returns the value of attribute tool.
10 11 12 |
# File 'lib/jira/auto/tool/performer/sprint_time_in_dates_aligner.rb', line 10 def tool @tool end |
Instance Method Details
#run ⇒ Object
22 23 24 |
# File 'lib/jira/auto/tool/performer/sprint_time_in_dates_aligner.rb', line 22 def run update_sprint_dates_with_expected_time end |
#update_sprint_dates_for(sprint) ⇒ Object
30 31 32 33 34 35 36 37 |
# File 'lib/jira/auto/tool/performer/sprint_time_in_dates_aligner.rb', line 30 def update_sprint_dates_for(sprint) return if sprint.closed? || !(sprint.start_date? || sprint.end_date?) sprint.start_date = date_with_expected_time(sprint.start_date) if sprint.start_date? sprint.end_date = date_with_expected_time(sprint.end_date) if sprint.end_date? sprint.save end |
#update_sprint_dates_with_expected_time ⇒ Object
26 27 28 |
# File 'lib/jira/auto/tool/performer/sprint_time_in_dates_aligner.rb', line 26 def update_sprint_dates_with_expected_time tool.unclosed_sprints.each { |sprint| update_sprint_dates_for(sprint) } end |