class PIM::NodeValue

Attributes

attributes[RW]
value[R]

Public Class Methods

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

Public Instance Methods

!() click to toggle source
# File pim.rb, line 2368
def !
  assimilate(false) == false
end
!=(other) click to toggle source
# File pim.rb, line 2343
def !=(other)
  other = other.value if other.is_a?(NodeValue)
  assimilate(other) != other
end
*(other) click to toggle source
# File pim.rb, line 2372
def *(other)
  other = other.value if other.is_a?(NodeValue)
  assimilate(other) * other
end
+(other) click to toggle source
# File pim.rb, line 2377
def +(other)
  other = other.value if other.is_a?(NodeValue)
  assimilate(other) + other
end
<(other) click to toggle source
# File pim.rb, line 2358
def <(other)
  other = other.value if other.is_a?(NodeValue)
  assimilate(other) < other
end
<=(other) click to toggle source
# File pim.rb, line 2363
def <=(other)
  other = other.value if other.is_a?(NodeValue)
  assimilate(other) <= other
end
==(other) click to toggle source
# File pim.rb, line 2338
def ==(other)
  other = other.value if other.is_a?(NodeValue)
  assimilate(other) == other
end
>(other) click to toggle source
# File pim.rb, line 2348
def >(other)
  other = other.value if other.is_a?(NodeValue)
  assimilate(other) > other
end
>=(other) click to toggle source
# File pim.rb, line 2353
def >=(other)
  other = other.value if other.is_a?(NodeValue)
  assimilate(other) >= other
end
[](key) click to toggle source
# File pim.rb, line 2424
def [](key)
  @attributes["#{key}"]
end
assimilate(other) click to toggle source
# File pim.rb, line 2382
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 2428
def fetch(key, other)
  @attributes.fetch(key, other)
end
nil?() click to toggle source
# File pim.rb, line 2432
def nil?
  value == nil
end
to_date() click to toggle source
# File pim.rb, line 2420
def to_date
  Date.parse(value)
end
to_f() click to toggle source
# File pim.rb, line 2416
def to_f
  value.to_f
end
to_i() click to toggle source
# File pim.rb, line 2412
def to_i
  value.to_i
end
to_json() click to toggle source
# File pim.rb, line 2436
def to_json
  value.to_json
end
to_s() click to toggle source
# File pim.rb, line 2408
def to_s
  value
end