Class: When::V::Timezone
- Inherits:
-
Root
- Object
- BasicTypes::Object
- Root
- When::V::Timezone
- Extended by:
- Parts::Resource::Pool
- Defined in:
- lib/when_exe/icalendar.rb
Overview
Timezone を定義する
BEGIN:VTIMEZONE...END:VTIMEZONE のブロックに対応
Constant Summary collapse
- Properties =
[['tzid'], [], ['last_modified', 'tzurl', 'x_lic_location'], [], []]
- Classes =
[Standard, Daylight]
Constants inherited from Root
Root::AwareProperties, Root::DefaultOptional, Root::DefaultUnique
Constants included from Parts::Resource
Parts::Resource::LabelProperty, Parts::Resource::Prefix, Parts::Resource::PrefixIndex, Parts::Resource::PrefixKeys, Parts::Resource::PrefixValues
Instance Attribute Summary collapse
-
#daylight ⇒ When::TM::Clock
readonly
夏時間帯の時計.
-
#difference ⇒ When::TM:IntervalLength
readonly
夏時間帯と標準時間帯の時間差.
-
#standard ⇒ When::TM::Clock
readonly
標準時間帯の時計.
Attributes inherited from Root
Attributes included from Parts::Resource
#_pool, #child, #keys, #locale, #namespace
Instance Method Summary collapse
- #_daylight(zdate = nil) ⇒ Object
- #_need_validate ⇒ Object
-
#current_period(current_date = Time.now) ⇒ Range
同一の時間帯を用いた期間.
-
#label ⇒ String
ユニーク識別名 - TZID Property をユニーク識別名とする.
Methods included from Parts::Resource::Pool
[], []=, _pool, _setup_, pool_keys
Methods included from Parts::Resource::Synchronize
Methods inherited from Root
Methods inherited from BasicTypes::Object
Methods included from Parts::Resource
#[], #^, _extract_prefix, _instance, _parse, _path_with_prefix, #each, #enum_for, #hierarchy, #include?, #included?, #iri, #leaf?, #m17n, #map, #next, #parent, #prev, #registered?
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class When::Parts::Resource
Instance Attribute Details
#daylight ⇒ When::TM::Clock (readonly)
夏時間帯の時計
845 846 847 |
# File 'lib/when_exe/icalendar.rb', line 845 def daylight @daylight end |
#difference ⇒ When::TM:IntervalLength (readonly)
夏時間帯と標準時間帯の時間差
849 850 851 |
# File 'lib/when_exe/icalendar.rb', line 849 def difference @difference end |
#standard ⇒ When::TM::Clock (readonly)
標準時間帯の時計
841 842 843 |
# File 'lib/when_exe/icalendar.rb', line 841 def standard @standard end |
Instance Method Details
#_daylight(zdate = nil) ⇒ Object
874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 |
# File 'lib/when_exe/icalendar.rb', line 874 def _daylight(zdate=nil) raise ArgumentError, "Needless daylight saving time evaluation" unless _need_validate zdate = yield(@standard.dup.tap{|clock| clock.tz_prop = nil}) if block_given? ndate = _neighbor_event_date(zdate) nprop = ndate.clock.tz_prop if block_given? && !@standard.equal?(nprop.tzoffsetfrom) zdate = yield(nprop.tzoffsetfrom.dup.tap{|clock| clock.tz_prop = nil}) end deltad = zdate.universal_time - ndate.universal_time if nprop.instance_of?(Standard) return nprop.tzoffsetto if (deltad >= @difference) return nprop.tzoffsetfrom else return nprop.tzoffsetto if (deltad >= 0) return nprop.tzoffsetfrom end end |
#_need_validate ⇒ Object
893 894 895 |
# File 'lib/when_exe/icalendar.rb', line 893 def _need_validate (@difference != 0) end |
#current_period(current_date = Time.now) ⇒ Range
同一の時間帯を用いた期間
865 866 867 868 869 870 871 |
# File 'lib/when_exe/icalendar.rb', line 865 def current_period(current_date=Time.now) current_date = When.when?(current_date) unless current_date.kind_of?(When::TM::TemporalPosition) period = _tz_period(current_date) range = period[1] return range if range.kind_of?(Range) GeometricComplex.new([period], !range) end |
#label ⇒ String
ユニーク識別名 - TZID Property をユニーク識別名とする
853 854 855 |
# File 'lib/when_exe/icalendar.rb', line 853 def label @property['tzid'].object end |