Module: TheCity::Time
- Included in:
- Content
- Defined in:
- lib/the_city/time.rb
Instance Method Summary collapse
- #created? ⇒ Boolean
-
#created_at ⇒ Time
Time when the object was created.
- #ended? ⇒ Boolean
-
#ending_at ⇒ Time
Time when the object ends.
- #started? ⇒ Boolean
-
#starting_at ⇒ Time
Time when the object starts.
- #updated? ⇒ Boolean
-
#updated_at ⇒ Time
Time when the object was updated.
Instance Method Details
#created? ⇒ Boolean
15 16 17 |
# File 'lib/the_city/time.rb', line 15 def created? !!@attrs[:created_at] end |
#created_at ⇒ Time
Time when the object was created
11 12 13 |
# File 'lib/the_city/time.rb', line 11 def created_at @created_at ||= parse_or_at(@attrs[:created_at]) if @attrs[:created_at] end |
#ended? ⇒ Boolean
48 49 50 |
# File 'lib/the_city/time.rb', line 48 def ended? !!@attrs[:ending_at] and ending_at <= Time.now end |
#ending_at ⇒ Time
Time when the object ends
44 45 46 |
# File 'lib/the_city/time.rb', line 44 def ending_at @ending_at ||= parse_or_at(@attrs[:ending_at]) if @attrs[:ending_at] end |
#started? ⇒ Boolean
37 38 39 |
# File 'lib/the_city/time.rb', line 37 def started? !!@attrs[:starting_at] and starting_at <= Time.now end |
#starting_at ⇒ Time
Time when the object starts
33 34 35 |
# File 'lib/the_city/time.rb', line 33 def starting_at @starting_at ||= parse_or_at(@attrs[:starting_at]) if @attrs[:starting_at] end |
#updated? ⇒ Boolean
26 27 28 |
# File 'lib/the_city/time.rb', line 26 def updated? !!@attrs[:updated_at] end |
#updated_at ⇒ Time
Time when the object was updated
22 23 24 |
# File 'lib/the_city/time.rb', line 22 def updated_at @updated_at ||= parse_or_at(@attrs[:updated_at]) if @attrs[:updated_at] end |