Class: ContentBlockTools::NormalisedDateRange
- Inherits:
-
Object
- Object
- ContentBlockTools::NormalisedDateRange
- Defined in:
- lib/content_block_tools/normalised_date_range.rb
Defined Under Namespace
Classes: ParseError
Instance Method Summary collapse
- #end_date ⇒ Object
- #end_time ⇒ Object
-
#initialize(date_range) ⇒ NormalisedDateRange
constructor
A new instance of NormalisedDateRange.
- #start_date ⇒ Object
- #start_time ⇒ Object
Constructor Details
#initialize(date_range) ⇒ NormalisedDateRange
Returns a new instance of NormalisedDateRange.
7 8 9 |
# File 'lib/content_block_tools/normalised_date_range.rb', line 7 def initialize(date_range) @date_range = date_range || {} end |
Instance Method Details
#end_date ⇒ Object
23 24 25 |
# File 'lib/content_block_tools/normalised_date_range.rb', line 23 def end_date end_time&.to_date end |
#end_time ⇒ Object
15 16 17 |
# File 'lib/content_block_tools/normalised_date_range.rb', line 15 def end_time @end_time ||= parse_value(date_range[:end]) end |
#start_date ⇒ Object
19 20 21 |
# File 'lib/content_block_tools/normalised_date_range.rb', line 19 def start_date start_time&.to_date end |
#start_time ⇒ Object
11 12 13 |
# File 'lib/content_block_tools/normalised_date_range.rb', line 11 def start_time @start_time ||= parse_value(date_range[:start]) end |