Class: Odin::Types::OdinBoolean

Inherits:
OdinValue show all
Defined in:
lib/odin/types/values.rb

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) ⇒ OdinBoolean

Returns a new instance of OdinBoolean.



84
85
86
87
88
# File 'lib/odin/types/values.rb', line 84

def initialize(value, **kwargs)
  super(**kwargs)
  @value = value
  freeze
end

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



82
83
84
# File 'lib/odin/types/values.rb', line 82

def value
  @value
end

Instance Method Details

#==(other) ⇒ Object Also known as: eql?



92
93
94
# File 'lib/odin/types/values.rb', line 92

def ==(other)
  other.is_a?(OdinBoolean) && value == other.value
end

#hashObject



97
98
99
# File 'lib/odin/types/values.rb', line 97

def hash
  [ValueType::BOOLEAN, value].hash
end

#to_sObject



101
102
103
# File 'lib/odin/types/values.rb', line 101

def to_s
  value.to_s
end

#typeObject



90
# File 'lib/odin/types/values.rb', line 90

def type; ValueType::BOOLEAN; end

#with_directives(dirs) ⇒ Object



109
110
111
# File 'lib/odin/types/values.rb', line 109

def with_directives(dirs)
  OdinBoolean.new(value, modifiers: modifiers, directives: dirs)
end

#with_modifiers(mods) ⇒ Object



105
106
107
# File 'lib/odin/types/values.rb', line 105

def with_modifiers(mods)
  OdinBoolean.new(value, modifiers: mods, directives: directives)
end