Class: KDL::Value::NullImpl

Inherits:
KDL::Value show all
Defined in:
lib/kdl/value.rb

Direct Known Subclasses

KDL::V1::Value::NullImpl

Constant Summary

Constants inherited from KDL::Value

Null

Instance Attribute Summary

Attributes inherited from KDL::Value

#format, #type, #value

Instance Method Summary collapse

Methods inherited from KDL::Value

#as_type, from, #inspect, #method_missing, #respond_to_missing?, #to_s, #to_v2, #version

Constructor Details

#initialize(_ = nil, format: nil, type: nil) ⇒ NullImpl

Returns a new instance of NullImpl.



125
126
127
# File 'lib/kdl/value.rb', line 125

def initialize(_=nil, format: nil, type: nil)
  super(nil, type: type)
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class KDL::Value

Instance Method Details

#==(other) ⇒ Object



133
134
135
# File 'lib/kdl/value.rb', line 133

def ==(other)
  other.is_a?(NullImpl) || other.nil?
end

#stringify_valueObject



129
130
131
# File 'lib/kdl/value.rb', line 129

def stringify_value
  "#null"
end

#to_v1Object



137
138
139
# File 'lib/kdl/value.rb', line 137

def to_v1
  type ? V1::Value::NullImpl.new(type:) : V1::Value::Null
end