Class: RiCal::Component::Calendar::TZInfoWrapper

Inherits:
Object
  • Object
show all
Defined in:
lib/ri_cal/component/calendar.rb

Overview

:nodoc:

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(tzinfo, calendar) ⇒ TZInfoWrapper

:nodoc:



106
107
108
109
# File 'lib/ri_cal/component/calendar.rb', line 106

def initialize(tzinfo, calendar) #:nodoc:
  @tzinfo = tzinfo
  @calendar = calendar
end

Instance Attribute Details

#calendarObject (readonly)

:nodoc:



105
106
107
# File 'lib/ri_cal/component/calendar.rb', line 105

def calendar
  @calendar
end

#tzinfoObject (readonly)

:nodoc:



105
106
107
# File 'lib/ri_cal/component/calendar.rb', line 105

def tzinfo
  @tzinfo
end

Instance Method Details

#date_time(ruby_time, tzid) ⇒ Object

:nodoc:



115
116
117
# File 'lib/ri_cal/component/calendar.rb', line 115

def date_time(ruby_time, tzid) #:nodoc:
  RiCal::PropertyValue::DateTime.new(calendar, :value => ruby_time, :params => {'TZID' => tzid})
end

#identifierObject

:nodoc:



111
112
113
# File 'lib/ri_cal/component/calendar.rb', line 111

def identifier #:nodoc:
  tzinfo.identifier
end

#local_to_utc(utc) ⇒ Object

:nodoc:



119
120
121
# File 'lib/ri_cal/component/calendar.rb', line 119

def local_to_utc(utc) #:nodoc:
  date_time(tzinfo.local_to_utc(utc.to_ri_cal_ruby_value), 'UTC')
end

#utc_to_local(local) ⇒ Object

:nodoc:



123
124
125
# File 'lib/ri_cal/component/calendar.rb', line 123

def utc_to_local(local) #:nodoc:
  date_time(tzinfo.utc_to_local(local.to_ri_cal_ruby_value), tzinfo.identifier)
end