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.



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

def timezone_store
  @timezone_store
end

#tz_utcObject (readonly)

Returns the value of attribute tz_utc.



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

def tz_utc
  @tz_utc
end

Instance Method Details

#__getobj__Object



32
33
34
35
36
37
38
39
40
41
# File 'lib/icalendar/values/helpers/time_with_zone.rb', line 32

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



25
26
27
28
29
30
# File 'lib/icalendar/values/helpers/time_with_zone.rb', line 25

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



43
44
45
46
# File 'lib/icalendar/values/helpers/time_with_zone.rb', line 43

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