Class: DecisionAgent::Dmn::Feel::Types::Time
- Inherits:
-
Object
- Object
- DecisionAgent::Dmn::Feel::Types::Time
- Defined in:
- lib/decision_agent/dmn/feel/types.rb
Overview
Wrapper for time values
Instance Attribute Summary collapse
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
- #==(other) ⇒ Object
-
#initialize(value) ⇒ Time
constructor
A new instance of Time.
- #inspect ⇒ Object
- #to_ruby ⇒ Object
Constructor Details
#initialize(value) ⇒ Time
Returns a new instance of Time.
102 103 104 105 106 107 108 109 110 111 112 113 114 |
# File 'lib/decision_agent/dmn/feel/types.rb', line 102 def initialize(value) @value = case value when ::Time then value when String then parse_time(value) else raise FeelTypeError.new( "Cannot convert to Time", expected_type: "Time", actual_type: value.class, value: value ) end end |
Instance Attribute Details
#value ⇒ Object (readonly)
Returns the value of attribute value.
100 101 102 |
# File 'lib/decision_agent/dmn/feel/types.rb', line 100 def value @value end |
Instance Method Details
#==(other) ⇒ Object
120 121 122 123 124 |
# File 'lib/decision_agent/dmn/feel/types.rb', line 120 def ==(other) return @value == other.value if other.is_a?(Time) @value == other end |
#inspect ⇒ Object
126 127 128 |
# File 'lib/decision_agent/dmn/feel/types.rb', line 126 def inspect "#<Feel::Time #{@value}>" end |
#to_ruby ⇒ Object
116 117 118 |
# File 'lib/decision_agent/dmn/feel/types.rb', line 116 def to_ruby @value end |