Class: SDL4R::Parser::TimeSpanWithZone
- Inherits:
-
Object
- Object
- SDL4R::Parser::TimeSpanWithZone
- Defined in:
- lib/sdl4r/parser/time_span_with_zone.rb
Overview
An intermediate object used to store a timeSpan or the time component of a date/time instance. The types are disambiguated at a later stage.
seconds
can have a fraction time_zone_offset
is a fraction of a day (equal to nil if not specified)
Instance Attribute Summary collapse
-
#day ⇒ Object
readonly
Returns the value of attribute day.
-
#hour ⇒ Object
readonly
Returns the value of attribute hour.
-
#min ⇒ Object
readonly
Returns the value of attribute min.
-
#sec ⇒ Object
readonly
Returns the value of attribute sec.
-
#time_zone_offset ⇒ Object
readonly
Returns the value of attribute time_zone_offset.
Class Method Summary collapse
-
.default_time_zone_offset ⇒ Object
Returns the UTC offset as a fraction of a day on the current machine.
Instance Method Summary collapse
-
#initialize(day, hour, minute, second, time_zone_offset) ⇒ TimeSpanWithZone
constructor
A new instance of TimeSpanWithZone.
Constructor Details
#initialize(day, hour, minute, second, time_zone_offset) ⇒ TimeSpanWithZone
Returns a new instance of TimeSpanWithZone.
38 39 40 41 42 43 44 |
# File 'lib/sdl4r/parser/time_span_with_zone.rb', line 38 def initialize(day, hour, minute, second, time_zone_offset) @day = day @hour = hour @min = minute @sec = second @time_zone_offset = time_zone_offset end |
Instance Attribute Details
#day ⇒ Object (readonly)
Returns the value of attribute day.
46 47 48 |
# File 'lib/sdl4r/parser/time_span_with_zone.rb', line 46 def day @day end |
#hour ⇒ Object (readonly)
Returns the value of attribute hour.
46 47 48 |
# File 'lib/sdl4r/parser/time_span_with_zone.rb', line 46 def hour @hour end |
#min ⇒ Object (readonly)
Returns the value of attribute min.
46 47 48 |
# File 'lib/sdl4r/parser/time_span_with_zone.rb', line 46 def min @min end |
#sec ⇒ Object (readonly)
Returns the value of attribute sec.
46 47 48 |
# File 'lib/sdl4r/parser/time_span_with_zone.rb', line 46 def sec @sec end |
#time_zone_offset ⇒ Object (readonly)
Returns the value of attribute time_zone_offset.
46 47 48 |
# File 'lib/sdl4r/parser/time_span_with_zone.rb', line 46 def time_zone_offset @time_zone_offset end |
Class Method Details
.default_time_zone_offset ⇒ Object
Returns the UTC offset as a fraction of a day on the current machine
49 50 51 |
# File 'lib/sdl4r/parser/time_span_with_zone.rb', line 49 def TimeSpanWithZone.default_time_zone_offset return Rational(Time.now.utc_offset, SECONDS_IN_DAY) end |