Class: Timeframe::Iso8601::Side

Inherits:
Object
  • Object
show all
Defined in:
lib/timeframe/iso_8601.rb

Overview

Internal use.

Direct Known Subclasses

A, B

Constant Summary collapse

EXCLUDED_LAST_DAY =

We add one day because so that it can be excluded per timeframe’s conventions.

86_400

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#date_partObject (readonly)

Returns the value of attribute date_part.



30
31
32
# File 'lib/timeframe/iso_8601.rb', line 30

def date_part
  @date_part
end

#time_partObject (readonly)

Returns the value of attribute time_part.



31
32
33
# File 'lib/timeframe/iso_8601.rb', line 31

def time_part
  @time_part
end

Instance Method Details

#to_time(counterpart) ⇒ Object



32
33
34
35
36
37
38
# File 'lib/timeframe/iso_8601.rb', line 32

def to_time(counterpart)
  if date_part.start_with?('P')
    counterpart.resolve_time(self) + offset + EXCLUDED_LAST_DAY
  else
    resolve_time counterpart
  end
end