Class: WorkItems::RollupableDates
- Inherits:
-
Object
- Object
- WorkItems::RollupableDates
- Includes:
- Gitlab::Utils::StrongMemoize
- Defined in:
- app/models/work_items/rollupable_dates.rb
Instance Method Summary collapse
- #due_date ⇒ Object
- #due_date_fixed ⇒ Object
- #fixed? ⇒ Boolean
-
#initialize(source, can_rollup:) ⇒ RollupableDates
constructor
A new instance of RollupableDates.
- #start_date ⇒ Object
- #start_date_fixed ⇒ Object
Constructor Details
#initialize(source, can_rollup:) ⇒ RollupableDates
Returns a new instance of RollupableDates.
7 8 9 10 |
# File 'app/models/work_items/rollupable_dates.rb', line 7 def initialize(source, can_rollup:) @source = source @can_rollup = can_rollup end |
Instance Method Details
#due_date ⇒ Object
32 33 34 35 36 |
# File 'app/models/work_items/rollupable_dates.rb', line 32 def due_date return source.due_date_fixed if fixed? source.due_date end |
#due_date_fixed ⇒ Object
38 39 40 |
# File 'app/models/work_items/rollupable_dates.rb', line 38 def due_date_fixed source.due_date_fixed end |
#fixed? ⇒ Boolean
12 13 14 15 16 17 18 19 |
# File 'app/models/work_items/rollupable_dates.rb', line 12 def fixed? return true unless @can_rollup return true if source.start_date_is_fixed && source.start_date_fixed.present? return true if source.due_date_is_fixed && source.due_date_fixed.present? return true if source.start_date_is_fixed && source.due_date_is_fixed false end |
#start_date ⇒ Object
22 23 24 25 26 |
# File 'app/models/work_items/rollupable_dates.rb', line 22 def start_date return source.start_date_fixed if fixed? source.start_date end |
#start_date_fixed ⇒ Object
28 29 30 |
# File 'app/models/work_items/rollupable_dates.rb', line 28 def start_date_fixed source.start_date_fixed end |