class PIM::NodeValue

Attributes

attributes[RW]
value[R]

Public Class Methods

new(value) click to toggle source
# File pim.rb, line 1956
def initialize(value)
  @value = value
  @attributes = {}
end

Public Instance Methods

!() click to toggle source
# File pim.rb, line 1991
def !
  assimilate(false) == false
end
!=(other) click to toggle source
# File pim.rb, line 1966
def !=(other)
  other = other.value if other.is_a?(NodeValue)
  assimilate(other) != other
end
*(other) click to toggle source
# File pim.rb, line 1995
def *(other)
  other = other.value if other.is_a?(NodeValue)
  assimilate(other) * other
end
+(other) click to toggle source
# File pim.rb, line 2000
def +(other)
  other = other.value if other.is_a?(NodeValue)
  assimilate(other) + other
end
<(other) click to toggle source
# File pim.rb, line 1981
def <(other)
  other = other.value if other.is_a?(NodeValue)
  assimilate(other) < other
end
<=(other) click to toggle source
# File pim.rb, line 1986
def <=(other)
  other = other.value if other.is_a?(NodeValue)
  assimilate(other) <= other
end
==(other) click to toggle source
# File pim.rb, line 1961
def ==(other)
  other = other.value if other.is_a?(NodeValue)
  assimilate(other) == other
end
>(other) click to toggle source
# File pim.rb, line 1971
def >(other)
  other = other.value if other.is_a?(NodeValue)
  assimilate(other) > other
end
>=(other) click to toggle source
# File pim.rb, line 1976
def >=(other)
  other = other.value if other.is_a?(NodeValue)
  assimilate(other) >= other
end
[](key) click to toggle source
# File pim.rb, line 2047
def [](key)
  @attributes["#{key}"]
end
assimilate(other) click to toggle source
# File pim.rb, line 2005
def assimilate(other)
  case other
  when Integer
    value.to_i
  when Float
    value.to_f
  when FalseClass, TrueClass
    not ['', 'false'].include?(value.to_s.downcase)
  when Date
    Date.parse(value)
  when DateTime
    DateTime.parse(value)
  else
    case value
    when 'true'
      true
    when 'false'
      false
    when nil
      value
    else
        value.to_s
    end
  end
end
fetch(key, other) click to toggle source
# File pim.rb, line 2051
def fetch(key, other)
  @attributes.fetch(key, other)
end
nil?() click to toggle source
# File pim.rb, line 2055
def nil?
  value == nil
end
to_date() click to toggle source
# File pim.rb, line 2043
def to_date
  Date.parse(value)
end
to_f() click to toggle source
# File pim.rb, line 2039
def to_f
  value.to_f
end
to_i() click to toggle source
# File pim.rb, line 2035
def to_i
  value.to_i
end
to_json() click to toggle source
# File pim.rb, line 2059
def to_json
  value.to_json
end
to_s() click to toggle source
# File pim.rb, line 2031
def to_s
  value
end