Class: When::TM::Position
- Inherits:
-
Object
- Object
- When::TM::Position
- Includes:
- Parts::Resource, IndeterminateValue
- Defined in:
- lib/when_exe/tmposition.rb
Overview
時間位置共用体 union of
When::TM::TemporalPosition
When::BasicTypes::Date
When::BasicTypes::Time
When::BasicTypes::DateTime
see gml schema
Constant Summary collapse
- HashProperty =
[:indeterminated_position, :frame, [:precision, When::SYSTEM], :events, :options, :trans, :query, :location, [:time_standard, When::TimeStandard::UniversalTime], [:rate_of_clock, 1.0]]
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
Constants included from IndeterminateValue
IndeterminateValue::After, IndeterminateValue::Before, IndeterminateValue::I, IndeterminateValue::Max, IndeterminateValue::Min, IndeterminateValue::Now, IndeterminateValue::S, IndeterminateValue::Unknown
Instance Attribute Summary collapse
-
#any_other ⇒ When::TM::TemporalPosition
readonly
時間位置.
-
#date_time8601 ⇒ When::BasicTypes::DateTime
(also: #dateTime8601)
readonly
代表文字列.
Attributes included from Parts::Resource
#_pool, #child, #keys, #locale, #namespace
Class Method Summary collapse
-
.any_other(position, options = {}) ⇒ When::TM::TemporalPosition
諸々のオブジェクトから When::TM::TemporalPosition を取り出す.
Instance Method Summary collapse
-
#anyOther ⇒ When::TM::TemporalPosition
時間位置.
-
#initialize(specification, options = {}) ⇒ Position
constructor
オブジェクトの生成.
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
Methods included from Parts::Resource::Pool
#[], #[]=, #_pool, #_setup_, #pool_keys
Methods included from Parts::Resource::Synchronize
Constructor Details
#initialize(specification, options = {}) ⇒ Position
specification が String 以外の場合、そのオブジェクトの代表的な日時 (When::TM::CalendarEra#reference_dateなど)により解釈する
オブジェクトの生成
107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 |
# File 'lib/when_exe/tmposition.rb', line 107 def initialize(specification, ={}) case specification when String @date_time8601 = specification @any_other = TemporalPosition._instance(specification, ) when Position @date_time8601 = specification.date_time8601 @any_other = specification.any_other return else @any_other = specification end klass = specification.class = "Irregal specification type: #{klass}" case specification when CalDate ; @date_time8601 = When::BasicTypes::Date.new(specification.to_s) when ClockTime ; @date_time8601 = When::BasicTypes::Time.new(specification.to_s) when TemporalPosition ; @date_time8601 = When::BasicTypes::DateTime.new(specification.to_s) when CalendarEra ; @date_time8601 = When::BasicTypes::Date.new(specification.reference_date.to_s) when OrdinalEra ; @date_time8601 = When::BasicTypes::Date.new(specification.begin.to_s) when When::BasicTypes::Date ; raise TypeError, unless klass == CalDate when When::BasicTypes::Time ; raise TypeError, unless klass == ClockTime when String ; else ; raise TypeError, end end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args, &block) ⇒ Object (private)
When::TM::Position で定義されていないメソッドは 処理を @date_time8601 (type: When::BasicTypes::DateTime) または @any_other (type: When::TM::TemporalPosition) に委譲する (両方ともに有効なメソッドは@any_otherを優先する)
その他のメソッド
149 150 151 152 153 154 155 156 157 158 159 |
# File 'lib/when_exe/tmposition.rb', line 149 def method_missing(name, *args, &block) return _method_missing(name, *args, &block) if When::Parts::MethodCash::Escape.key?(name) self.class.module_eval %Q{ def #{name}(*args, &block) union = @any_other.respond_to?("#{name}") ? @any_other : @date_time8601 union.send("#{name}", *args, &block) end } unless When::Parts::MethodCash.escape(name) union = @any_other.respond_to?(name) ? @any_other : @date_time8601 union.send(name, *args, &block) end |
Instance Attribute Details
#any_other ⇒ When::TM::TemporalPosition (readonly)
時間位置
73 74 75 |
# File 'lib/when_exe/tmposition.rb', line 73 def any_other @any_other end |
#date_time8601 ⇒ When::BasicTypes::DateTime (readonly) Also known as: dateTime8601
代表文字列
66 67 68 |
# File 'lib/when_exe/tmposition.rb', line 66 def date_time8601 @date_time8601 end |
Class Method Details
.any_other(position, options = {}) ⇒ When::TM::TemporalPosition
諸々のオブジェクトから When::TM::TemporalPosition を取り出す
88 89 90 91 92 93 94 95 |
# File 'lib/when_exe/tmposition.rb', line 88 def self.any_other(position, ={}) case position when TemporalPosition ; position when Position ; position.any_other when When::Parts::GeometricComplex ; position.first else ; When.Calendar([:frame] || 'Gregorian').jul_trans(position, ) || position end end |
Instance Method Details
#anyOther ⇒ When::TM::TemporalPosition
時間位置
74 75 76 |
# File 'lib/when_exe/tmposition.rb', line 74 def any_other @any_other end |