Module: TheCity::Time

Included in:
Content
Defined in:
lib/the_city/time.rb

Instance Method Summary collapse

Instance Method Details

#created?Boolean

Returns:

  • (Boolean)


15
16
17
# File 'lib/the_city/time.rb', line 15

def created?
  !!@attrs[:created_at]
end

#created_atTime

Time when the object was created

Returns:



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

Returns:

  • (Boolean)


48
49
50
# File 'lib/the_city/time.rb', line 48

def ended?
  !!@attrs[:ending_at] and ending_at <= Time.now
end

#ending_atTime

Time when the object ends

Returns:



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

Returns:

  • (Boolean)


37
38
39
# File 'lib/the_city/time.rb', line 37

def started?
  !!@attrs[:starting_at] and starting_at <= Time.now
end

#starting_atTime

Time when the object starts

Returns:



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

Returns:

  • (Boolean)


26
27
28
# File 'lib/the_city/time.rb', line 26

def updated?
  !!@attrs[:updated_at]
end

#updated_atTime

Time when the object was updated

Returns:



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