Class: Date
- Inherits:
-
Object
- Object
- Date
- Includes:
- When::TM::TemporalPosition::Conversion
- Defined in:
- lib/when_exe/core/duration.rb,
lib/when_exe/core/extension.rb
Instance Method Summary collapse
-
#+(other) ⇒ ::Date
加算.
-
#-(other) ⇒ ::Date
減算.
- #_minus_ ⇒ Object
- #_plus_ ⇒ Object
-
#tm_pos(options = {}) ⇒ When::TM::CalDate, When::TM::DateAndTime
(also: #to_tm_pos)
対応する When::TM::CalDate or DateAndTime を生成.
Methods included from When::TM::TemporalPosition::Conversion
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args, &block) ⇒ Object (private)
Note:
self で定義されていないメソッドは tm_pos で変換して処理する
その他のメソッド
90 91 92 93 94 95 96 97 98 99 100 |
# File 'lib/when_exe/core/extension.rb', line 90 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) result = tm_pos.send("#{name}", *args, &block) result.kind_of?(When::TimeValue) ? result.to_date_or_datetime : result end } unless When::Parts::MethodCash.escape(name) result = tm_pos.send(name, *args, &block) result.kind_of?(When::TimeValue) ? result.to_date_or_datetime : result end |
Instance Method Details
#+(other) ⇒ ::Date
加算
48 49 50 |
# File 'lib/when_exe/core/duration.rb', line 48 def +(other) other.kind_of?(When::TM::Duration) ? self + other.rational_duration : self._plus_(other) end |
#-(other) ⇒ ::Date
減算
62 63 64 65 66 67 68 |
# File 'lib/when_exe/core/duration.rb', line 62 def -(other) case other when When::TM::Duration ; self - other.rational_duration when When::TimeValue ; self._minus_(other.to_date_or_datetime) else ; self._minus_(other) end end |
#_minus_ ⇒ Object
54 |
# File 'lib/when_exe/core/duration.rb', line 54 alias :_minus_ :- |
#_plus_ ⇒ Object
40 |
# File 'lib/when_exe/core/duration.rb', line 40 alias :_plus_ :+ |
#tm_pos(options = {}) ⇒ When::TM::CalDate, When::TM::DateAndTime Also known as: to_tm_pos
Note:
暦法の指定がない場合、start メソッドの値によって Julian / Gregorian / Civil 暦法を選択する
対応する When::TM::CalDate or DateAndTime を生成
73 74 75 76 |
# File 'lib/when_exe/core/extension.rb', line 73 def tm_pos(={}) [:frame] ||= When::CalendarTypes::Christian._default_start(self) super() end |