Class: RiCal::Component::Calendar::TZInfoWrapper
- Defined in:
- lib/ri_cal/component/calendar.rb
Overview
:nodoc:
Instance Attribute Summary collapse
-
#calendar ⇒ Object
readonly
:nodoc:.
-
#tzinfo ⇒ Object
readonly
:nodoc:.
Instance Method Summary collapse
-
#identifier ⇒ Object
:nodoc:.
-
#initialize(tzinfo, calendar) ⇒ TZInfoWrapper
constructor
:nodoc:.
-
#local_date_time(ruby_time, tzid) ⇒ Object
:nodoc:.
-
#local_to_utc(utc) ⇒ Object
:nodoc:.
- #rational_utc_offset(local) ⇒ Object
-
#utc_date_time(ruby_time) ⇒ Object
:nodoc.
-
#utc_to_local(local) ⇒ Object
:nodoc:.
Constructor Details
#initialize(tzinfo, calendar) ⇒ TZInfoWrapper
:nodoc:
112 113 114 115 |
# File 'lib/ri_cal/component/calendar.rb', line 112 def initialize(tzinfo, calendar) #:nodoc: @tzinfo = tzinfo @calendar = calendar end |
Instance Attribute Details
#calendar ⇒ Object (readonly)
:nodoc:
111 112 113 |
# File 'lib/ri_cal/component/calendar.rb', line 111 def calendar @calendar end |
#tzinfo ⇒ Object (readonly)
:nodoc:
111 112 113 |
# File 'lib/ri_cal/component/calendar.rb', line 111 def tzinfo @tzinfo end |
Instance Method Details
#identifier ⇒ Object
:nodoc:
117 118 119 |
# File 'lib/ri_cal/component/calendar.rb', line 117 def identifier #:nodoc: tzinfo.identifier end |
#local_date_time(ruby_time, tzid) ⇒ Object
:nodoc:
121 122 123 |
# File 'lib/ri_cal/component/calendar.rb', line 121 def local_date_time(ruby_time, tzid) #:nodoc: RiCal::PropertyValue::DateTime.new(calendar, :value => ruby_time.strftime("%Y%m%dT%H%M%S"), :params => {'TZID' => tzid}) end |
#local_to_utc(utc) ⇒ Object
:nodoc:
129 130 131 |
# File 'lib/ri_cal/component/calendar.rb', line 129 def local_to_utc(utc) #:nodoc: utc_date_time(tzinfo.local_to_utc(utc.to_ri_cal_ruby_value)) end |
#rational_utc_offset(local) ⇒ Object
138 139 140 |
# File 'lib/ri_cal/component/calendar.rb', line 138 def rational_utc_offset(local) RiCal.RationalOffset[tzinfo.period_for_local(local, true).utc_total_offset] end |
#utc_date_time(ruby_time) ⇒ Object
:nodoc
125 126 127 |
# File 'lib/ri_cal/component/calendar.rb', line 125 def utc_date_time(ruby_time) #:nodoc RiCal::PropertyValue::DateTime.new(calendar, :value => ruby_time.strftime("%Y%m%dT%H%M%SZ")) end |
#utc_to_local(local) ⇒ Object
:nodoc:
133 134 135 |
# File 'lib/ri_cal/component/calendar.rb', line 133 def utc_to_local(local) #:nodoc: local_date_time(tzinfo.utc_to_local(local.to_ri_cal_ruby_value), tzinfo.identifier) end |