module Icalendar::Values::TimeWithZone
Attributes
tz_utc[R]
Public Class Methods
new(value, params = {})
click to toggle source
Calls superclass method
# File lib/icalendar/values/time_with_zone.rb, line 24 def initialize(value, params = {}) params = Icalendar::DowncasedHash(params) @tz_utc = params['tzid'] == 'UTC' x_tz_info = params.delete 'x-tz-info' offset_value = unless params['tzid'].nil? tzid = params['tzid'].is_a?(::Array) ? params['tzid'].first : params['tzid'] if defined?(ActiveSupport::TimeZone) && defined?(ActiveSupportTimeWithZoneAdapter) && (tz = ActiveSupport::TimeZone[tzid]) ActiveSupportTimeWithZoneAdapter.new(nil, tz, value) elsif !x_tz_info.nil? offset = x_tz_info.offset_for_local(value).to_s if value.respond_to?(:change) value.change offset: offset else ::Time.new value.year, value.month, value.day, value.hour, value.min, value.sec, offset end end end super((offset_value || value), params) end
Public Instance Methods
params_ical()
click to toggle source
Calls superclass method
# File lib/icalendar/values/time_with_zone.rb, line 47 def params_ical ical_params.delete 'tzid' if tz_utc super end