Module: Icalendar::Values::Helpers::TimeWithZone

Included in:
DateTime, Time
Defined in:
lib/icalendar/values/helpers/time_with_zone.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#timezone_storeObject (readonly)

Returns the value of attribute timezone_store.



18
19
20
# File 'lib/icalendar/values/helpers/time_with_zone.rb', line 18

def timezone_store
  @timezone_store
end

#tz_utcObject (readonly)

Returns the value of attribute tz_utc.



18
19
20
# File 'lib/icalendar/values/helpers/time_with_zone.rb', line 18

def tz_utc
  @tz_utc
end

Instance Method Details

#__getobj__Object



27
28
29
30
31
32
33
34
35
36
# File 'lib/icalendar/values/helpers/time_with_zone.rb', line 27

def __getobj__
  orig_value = super
  if set_offset?
    orig_value
  else
    offset = offset_value(orig_value, ical_params)
    __setobj__(offset) unless offset.nil?
    offset || orig_value
  end
end

#initialize(value, params = {}) ⇒ Object



20
21
22
23
24
25
# File 'lib/icalendar/values/helpers/time_with_zone.rb', line 20

def initialize(value, params = {})
  params = Icalendar::DowncasedHash(params)
  @tz_utc = params['tzid'] == 'UTC'
  @timezone_store = params.delete 'x-tz-store'
  super (offset_value(value, params) || value), params
end

#params_icalObject



38
39
40
41
# File 'lib/icalendar/values/helpers/time_with_zone.rb', line 38

def params_ical
  ical_params.delete 'tzid' if tz_utc
  super
end