Module: KDL::V1::Value::Methods

Included in:
KDL::V1::Value, Boolean, Float, Int, NullImpl, String
Defined in:
lib/kdl/v1/value.rb

Instance Method Summary collapse

Instance Method Details

#==(other) ⇒ Object



13
14
15
16
17
# File 'lib/kdl/v1/value.rb', line 13

def ==(other)
  return self == other.value if other.is_a?(self.class.superclass)

  value == other
end

#to_sObject



7
8
9
10
11
# File 'lib/kdl/v1/value.rb', line 7

def to_s
  return stringify_value unless type

  "(#{StringDumper.stringify_identifier type})#{stringify_value}"
end

#to_v1Object



23
24
25
# File 'lib/kdl/v1/value.rb', line 23

def to_v1
  self
end

#to_v2Object



27
28
29
# File 'lib/kdl/v1/value.rb', line 27

def to_v2
  self.class.superclass.new(value, format:, type:)
end

#versionObject



19
20
21
# File 'lib/kdl/v1/value.rb', line 19

def version
  1
end