Class: SDL4R::Parser::TimeSpanWithZone

Inherits:
Object
  • Object
show all
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

Class Method Summary collapse

Instance Method Summary collapse

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

#dayObject (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

#hourObject (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

#minObject (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

#secObject (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_offsetObject (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_offsetObject

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