Class: Nucleo::Models::DateRange
- Inherits:
-
Object
- Object
- Nucleo::Models::DateRange
- Defined in:
- lib/nucleo/models/date_range.rb
Instance Method Summary collapse
-
#days ⇒ Integer
Returns the inclusive days for this range.
-
#end_date ⇒ Date?
Returns the end date.
-
#initialize(attributes = {}) ⇒ Nucleo::Models::DateRange
constructor
Returns an instance of the DateRange domain model.
-
#start_date ⇒ Date?
Returns the start date.
Constructor Details
#initialize(attributes = {}) ⇒ Nucleo::Models::DateRange
Returns an instance of the DateRange domain model
9 10 11 |
# File 'lib/nucleo/models/date_range.rb', line 9 def initialize(attributes={}) @attributes = attributes end |
Instance Method Details
#days ⇒ Integer
Returns the inclusive days for this range
16 17 18 19 20 |
# File 'lib/nucleo/models/date_range.rb', line 16 def days return nil unless both_dates? ((self.end_date - self.start_date) + 1).to_i end |
#end_date ⇒ Date?
Returns the end date
36 37 38 39 40 41 42 |
# File 'lib/nucleo/models/date_range.rb', line 36 def end_date begin Date.parse(end_date_value) rescue nil end end |
#start_date ⇒ Date?
Returns the start date
25 26 27 28 29 30 31 |
# File 'lib/nucleo/models/date_range.rb', line 25 def start_date begin Date.parse(start_date_value) rescue nil end end |