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
Overview
Extensions to Date class
Instance Method Summary collapse
- #+(other) ⇒ Object
- #-(other) ⇒ Object
- #__method_missing ⇒ Object
- #_minus_ ⇒ Object
- #_plus_ ⇒ Object
-
#method_missing(name, *args, &block) ⇒ Object
その他のメソッド.
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
Note:
self で定義されていないメソッドは tm_position で変換して処理する
その他のメソッド
68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 |
# File 'lib/when_exe/core/extension.rb', line 68 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_position.send("#{name}", *args, &block) case result when When::TM::DateAndTime ; result.to_date_time when When::TM::CalDate ; result.to_date else ; result end end } unless When::Parts::MethodCash.escape(name) result = tm_position.send(name, *args, &block) case result when When::TM::DateAndTime ; result.to_date_time when When::TM::CalDate ; result.to_date else ; result end end |
Instance Method Details
#+(other) ⇒ Object
39 40 41 |
# File 'lib/when_exe/core/duration.rb', line 39 def +(other) other.kind_of?(When::TM::Duration) ? self + other.rational_duration : self._plus_(other) end |
#-(other) ⇒ Object
45 46 47 |
# File 'lib/when_exe/core/duration.rb', line 45 def -(other) other.kind_of?(When::TM::Duration) ? self - other.rational_duration : self._minus_(other) end |
#__method_missing ⇒ Object
60 |
# File 'lib/when_exe/core/extension.rb', line 60 alias :__method_missing :method_missing |
#_minus_ ⇒ Object
44 |
# File 'lib/when_exe/core/duration.rb', line 44 alias :_minus_ :- |
#_plus_ ⇒ Object
38 |
# File 'lib/when_exe/core/duration.rb', line 38 alias :_plus_ :+ |