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:
116 117 118 119 |
# File 'lib/ri_cal/component/calendar.rb', line 116 def initialize(tzinfo, calendar) #:nodoc: @tzinfo = tzinfo @calendar = calendar end |
Instance Attribute Details
#calendar ⇒ Object (readonly)
:nodoc:
115 116 117 |
# File 'lib/ri_cal/component/calendar.rb', line 115 def calendar @calendar end |
#tzinfo ⇒ Object (readonly)
:nodoc:
115 116 117 |
# File 'lib/ri_cal/component/calendar.rb', line 115 def tzinfo @tzinfo end |
Instance Method Details
#identifier ⇒ Object
:nodoc:
121 122 123 |
# File 'lib/ri_cal/component/calendar.rb', line 121 def identifier #:nodoc: tzinfo.identifier end |
#local_date_time(ruby_time, tzid) ⇒ Object
:nodoc:
125 126 127 |
# File 'lib/ri_cal/component/calendar.rb', line 125 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:
133 134 135 |
# File 'lib/ri_cal/component/calendar.rb', line 133 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
142 143 144 |
# File 'lib/ri_cal/component/calendar.rb', line 142 def rational_utc_offset(local) RiCal.RationalOffset[tzinfo.period_for_local(local, true).utc_total_offset] end |
#utc_date_time(ruby_time) ⇒ Object
:nodoc
129 130 131 |
# File 'lib/ri_cal/component/calendar.rb', line 129 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:
137 138 139 |
# File 'lib/ri_cal/component/calendar.rb', line 137 def utc_to_local(local) #:nodoc: local_date_time(tzinfo.utc_to_local(local.to_ri_cal_ruby_value), tzinfo.identifier) end |