Class: When::V::Root

Inherits:
BasicTypes::Object show all
Defined in:
lib/when_exe/icalendar.rb

Overview

iCalendar を構成するクラス群の共通抽象クラス

RFC 5545 のクラスは、有無のチェックを除いてProperty の扱いが共通なので、
Property の扱いを、本クラスにまとめて記述している。

Direct Known Subclasses

Calendar, Event, Timezone

Constant Summary collapse

Properties =
[[],[],[],[],[]]
Classes =
nil
DefaultUnique =
['calscale', 'namespace', 'locale']
DefaultOptional =
['x_prop', 'iana_prop']
AwareProperties =
DefaultUnique + 
                      ['tzoffsetfrom', 'tzoffsetto', 'tzname',
'dtstart', 'dtend', 'due',
'repeat', 'duration',
'rrule', 'rdate', 'exdate', 'exevent',
'summary', 'freebusy']

Constants included from Parts::Resource

Parts::Resource::LabelProperty

Instance Attribute Summary collapse

Attributes inherited from BasicTypes::Object

#label

Attributes included from Parts::Resource

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

Instance Method Summary collapse

Methods inherited from BasicTypes::Object

#tap

Methods included from Parts::Resource

#[], #^, _extract_prefix, _instance, _parse, _path_with_prefix, _setup_, #each, #hierarchy, #included?, #iri, #leaf?, #m17n, #map, #next, #parent, #prev, #registered?

Methods included from Parts::Resource::Pool

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

Methods included from Parts::Resource::Synchronize

#synchronize

Dynamic Method Handling

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

Instance Attribute Details

#calscaleWhen::TM::Calendar (readonly)

Note:

RFC 5545 では、‘GREGORIAN’ のみ指定可能としている。 CALSCALE Property 文字列を capitalize したものに、 prefix _c:(=hosi.org/When/CalendarTypes/)を補い When::TM::Calendar オブジェクトの定義を取得する。

デフォルトのWhen::TM::Calendar

Returns:



103
104
105
# File 'lib/when_exe/icalendar.rb', line 103

def calscale
  @calscale
end

#propertyHash (readonly)

iCalendar クラス群の属性

Returns:

  • (Hash)

    { String => When::Parts::Resource::Element }



91
92
93
# File 'lib/when_exe/icalendar.rb', line 91

def property
  @property
end

Instance Method Details

#_enumerator(*args) ⇒ Object Also known as: to_enum, enum_for

イテレータの生成

Raises:

  • (ArgumentError)


122
123
124
125
126
127
128
129
130
131
132
133
134
# File 'lib/when_exe/icalendar.rb', line 122

def _enumerator(*args)
  options = When::Parts::Enumerator._options(args)
  args << options
  exdate  = options[:exdate]

  enumerators = _enumerator_list(args)
  raise ArgumentError, "No enumerator exists" if (enumerators.length==0)

  # Enumerator の生成
  return enumerators[0] if (enumerators.length==1 && exdate.node.size==0)
  options[:exdate] = exdate
  return When::Parts::Enumerator::Integrated.new(self, enumerators, *args)
end

#include?(date) ⇒ Boolean

指定の日時を含むか?

Parameters:

Returns:

  • (Boolean)
    true - 含む
    false - 含まない


113
114
115
116
117
118
# File 'lib/when_exe/icalendar.rb', line 113

def include?(date)
  first = enum_for(date).next
  return first.include?(date) if first.kind_of?(When::Parts::GeometricComplex)
  return first == date if first.precision <= date.precision
  return false
end