Class: Odin::Types::OdinNull

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

Instance Attribute Summary

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(**kwargs) ⇒ OdinNull

Returns a new instance of OdinNull.



49
50
51
52
# File 'lib/odin/types/values.rb', line 49

def initialize(**kwargs)
  super(**kwargs)
  freeze
end

Instance Method Details

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



57
58
59
# File 'lib/odin/types/values.rb', line 57

def ==(other)
  other.is_a?(OdinNull)
end

#hashObject



62
63
64
# File 'lib/odin/types/values.rb', line 62

def hash
  ValueType::NULL.hash
end

#to_sObject



66
67
68
# File 'lib/odin/types/values.rb', line 66

def to_s
  "~"
end

#typeObject



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

def type; ValueType::NULL; end

#valueObject



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

def value; nil; end

#with_directives(dirs) ⇒ Object



74
75
76
# File 'lib/odin/types/values.rb', line 74

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

#with_modifiers(mods) ⇒ Object



70
71
72
# File 'lib/odin/types/values.rb', line 70

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