Class: When::V::Timezone

Inherits:
Root show all
Extended by:
Parts::Resource::Pool
Includes:
Parts::Timezone::Base
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::ConstList, Parts::Resource::ConstTypes, Parts::Resource::IRIDecode, Parts::Resource::IRIDecodeTable, Parts::Resource::IRIEncode, Parts::Resource::IRIEncodeTable, Parts::Resource::IRIHeader, Parts::Resource::LabelProperty

Instance Attribute Summary

Attributes included from Parts::Timezone::Base

#daylight, #standard, #tz_difference

Attributes inherited from Root

#calscale, #property

Attributes included from Parts::Resource

#_pool, #child, #keys, #locale, #namespace

Instance Method Summary collapse

Methods included from Parts::Resource::Pool

[], []=, _pool, _setup_, pool_keys

Methods included from Parts::Resource::Synchronize

#synchronize

Methods included from Parts::Timezone::Base

#^

Methods inherited from Root

#_enumerator, #include?

Methods included from Parts::Resource

#[], #^, _abbreviation_to_iri, _decode, _encode, _extract_prefix, _instance, _instantiate, _parse, _path_with_prefix, _replace_tags, _setup_, _setup_info, _simplify_path, base_uri, #each, #enum_for, #hierarchy, #include?, #included?, #iri, #leaf?, #m17n, #map, #next, #parent, #prev, #registered?, root_dir

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class When::Parts::Resource

Instance Method Details

#_daylight(time) ⇒ Object

Raises:

  • (ArgumentError)


922
923
924
925
926
927
928
929
930
# File 'lib/when_exe/icalendar.rb', line 922

def _daylight(time)
  raise ArgumentError, "Needless daylight saving time evaluation" unless _need_validate
  frame, cal_date, clk_time = time
  time   = frame.to_universal_time(cal_date, clk_time, @standard) if clk_time
  ndate  = _neighbor_event_date(time)
  nprop  = ndate.clock.tz_prop
  time   = frame.to_universal_time(cal_date, clk_time, nprop.tzoffsetfrom) if clk_time && !@standard.equal?(nprop.tzoffsetfrom)
  (time >= ndate.universal_time) ? nprop.tzoffsetto : nprop.tzoffsetfrom
end

#_need_validateObject



933
934
935
# File 'lib/when_exe/icalendar.rb', line 933

def _need_validate
  @tz_difference != 0
end

#current_period(current_date = Time.now) ⇒ Range

同一の時間帯を用いた期間

Parameters:

Returns:

  • (Range)
    期間が過去または未来に対して無限に続く場合は、GeometricComplex
    期間が有界の場合は、start…end という形式の Range


913
914
915
916
917
918
919
# File 'lib/when_exe/icalendar.rb', line 913

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.universal_time)
  range  = period[1]
  return range if range.kind_of?(Range)
  GeometricComplex.new([period], !range)
end

#labelString

ユニーク識別名 - TZID Property をユニーク識別名とする

Returns:



901
902
903
# File 'lib/when_exe/icalendar.rb', line 901

def label
  @label ||= @property['tzid'].object
end