Class: Odin::Types::OdinDuration
Instance Attribute Summary collapse
Attributes inherited from OdinValue
#directives, #modifiers
Instance Method Summary
collapse
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, **kwargs) ⇒ OdinDuration
Returns a new instance of OdinDuration.
396
397
398
399
400
|
# File 'lib/odin/types/values.rb', line 396
def initialize(value, **kwargs)
super(**kwargs)
@value = -value.to_s
freeze
end
|
Instance Attribute Details
#value ⇒ Object
Returns the value of attribute value.
394
395
396
|
# File 'lib/odin/types/values.rb', line 394
def value
@value
end
|
Instance Method Details
#==(other) ⇒ Object
Also known as:
eql?
404
405
406
|
# File 'lib/odin/types/values.rb', line 404
def ==(other)
other.is_a?(OdinDuration) && value == other.value
end
|
#hash ⇒ Object
409
410
411
|
# File 'lib/odin/types/values.rb', line 409
def hash
[ValueType::DURATION, value].hash
end
|
#to_s ⇒ Object
413
414
415
|
# File 'lib/odin/types/values.rb', line 413
def to_s
value
end
|
#with_directives(dirs) ⇒ Object
421
422
423
|
# File 'lib/odin/types/values.rb', line 421
def with_directives(dirs)
OdinDuration.new(value, modifiers: modifiers, directives: dirs)
end
|
#with_modifiers(mods) ⇒ Object
417
418
419
|
# File 'lib/odin/types/values.rb', line 417
def with_modifiers(mods)
OdinDuration.new(value, modifiers: mods, directives: directives)
end
|