Class: DecisionAgent::Dmn::Feel::Types::Date
- Inherits:
-
Object
- Object
- DecisionAgent::Dmn::Feel::Types::Date
- Defined in:
- lib/decision_agent/dmn/feel/types.rb
Overview
Wrapper for dates (ISO 8601)
Instance Attribute Summary collapse
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
- #==(other) ⇒ Object
-
#initialize(value) ⇒ Date
constructor
A new instance of Date.
- #inspect ⇒ Object
- #to_ruby ⇒ Object
Constructor Details
#initialize(value) ⇒ Date
Returns a new instance of Date.
56 57 58 59 60 61 62 63 |
# File 'lib/decision_agent/dmn/feel/types.rb', line 56 def initialize(value) @value = case value when ::Time, ::Date, ::DateTime then value when String then parse_date(value) else raise FeelTypeError, "Cannot convert #{value.class} to Date: #{value.inspect}" end end |
Instance Attribute Details
#value ⇒ Object (readonly)
Returns the value of attribute value.
54 55 56 |
# File 'lib/decision_agent/dmn/feel/types.rb', line 54 def value @value end |
Instance Method Details
#==(other) ⇒ Object
69 70 71 72 73 |
# File 'lib/decision_agent/dmn/feel/types.rb', line 69 def ==(other) return @value == other.value if other.is_a?(Date) @value == other end |
#inspect ⇒ Object
75 76 77 |
# File 'lib/decision_agent/dmn/feel/types.rb', line 75 def inspect "#<Feel::Date #{@value}>" end |
#to_ruby ⇒ Object
65 66 67 |
# File 'lib/decision_agent/dmn/feel/types.rb', line 65 def to_ruby @value end |