Class: Odin::Types::OdinDate
- Defined in:
- lib/odin/types/values.rb
Instance Attribute Summary collapse
-
#raw ⇒ Object
readonly
Returns the value of attribute raw.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Attributes inherited from OdinValue
Instance Method Summary collapse
- #==(other) ⇒ Object (also: #eql?)
- #hash ⇒ Object
-
#initialize(value, raw: nil, **kwargs) ⇒ OdinDate
constructor
A new instance of OdinDate.
- #to_s ⇒ Object
- #type ⇒ Object
- #with_directives(dirs) ⇒ Object
- #with_modifiers(mods) ⇒ Object
Methods inherited from OdinValue
#array?, #binary?, #boolean?, #confidential?, #currency?, #date?, #deprecated?, #duration?, #integer?, #null?, #number?, #numeric?, #object?, #percent?, #reference?, #required?, #string?, #temporal?, #time?, #timestamp?, #verb?
Constructor Details
#initialize(value, raw: nil, **kwargs) ⇒ OdinDate
Returns a new instance of OdinDate.
295 296 297 298 299 300 |
# File 'lib/odin/types/values.rb', line 295 def initialize(value, raw: nil, **kwargs) super(**kwargs) @value = value @raw = (raw || value.to_s).freeze freeze end |
Instance Attribute Details
#raw ⇒ Object (readonly)
Returns the value of attribute raw.
293 294 295 |
# File 'lib/odin/types/values.rb', line 293 def raw @raw end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
293 294 295 |
# File 'lib/odin/types/values.rb', line 293 def value @value end |
Instance Method Details
#==(other) ⇒ Object Also known as: eql?
304 305 306 |
# File 'lib/odin/types/values.rb', line 304 def ==(other) other.is_a?(OdinDate) && value == other.value end |
#hash ⇒ Object
309 310 311 |
# File 'lib/odin/types/values.rb', line 309 def hash [ValueType::DATE, value].hash end |
#to_s ⇒ Object
313 314 315 |
# File 'lib/odin/types/values.rb', line 313 def to_s raw end |