Class: Timeframe::Iso8601::A
Overview
Internal use.
The “A” side of “A/B”
Constant Summary
Constants inherited from Side
Instance Attribute Summary
Attributes inherited from Side
Instance Method Summary collapse
-
#initialize(raw) ⇒ A
constructor
A new instance of A.
-
#offset ⇒ Object
When A is a period, it counts as a negative offset to B.
- #resolve_time ⇒ Object
Methods inherited from Side
Constructor Details
#initialize(raw) ⇒ A
Returns a new instance of A.
45 46 47 48 49 |
# File 'lib/timeframe/iso_8601.rb', line 45 def initialize(raw) raw = raw.upcase @date_part, @time_part = raw.split('T') @time_part ||= '' end |
Instance Method Details
#offset ⇒ Object
When A is a period, it counts as a negative offset to B.
54 55 56 |
# File 'lib/timeframe/iso_8601.rb', line 54 def offset 0.0 - Duration.new(date_part, time_part).seconds end |
#resolve_time ⇒ Object
50 51 52 |
# File 'lib/timeframe/iso_8601.rb', line 50 def resolve_time(*) Time.parse [date_part, time_part].join('T') end |