Sha256: 7115602683ab03fbfc169cd2b7707c1cfc5ff2414542f8c4a352fc6aeed25c9e

Contents?: true

Size: 1.33 KB

Versions: 4

Compression:

Stored size: 1.33 KB

Contents

require_relative 'qname'

module Saxon
  # An XPath Data Model Node object, representing an XML document, or an element or one of the other node chunks in the XDM.
  class XdmAtomicValue
    # convert a single Ruby value into an XdmAtomicValue
    #
    # @param value the value to convert
    # @return [Saxon::XdmAtomicValue]
    def self.create(value)
      new(Saxon::S9API::XdmAtomicValue.new(value))
    end

    attr_reader :s9_xdm_atomic_value
    private :s9_xdm_atomic_value

    # @api private
    def initialize(s9_xdm_atomic_value)
      @s9_xdm_atomic_value = s9_xdm_atomic_value
    end

    # Return a {QName} representing the type of the value
    #
    # @return [Saxon::QName] the {QName} of the value's type
    def type_name
      @type_name ||= Saxon::QName.new(s9_xdm_atomic_value.getTypeName)
    end

    # @return [Saxon::S9API::XdmAtomicValue] The underlying Saxon Java XDM atomic value object.
    def to_java
      s9_xdm_atomic_value
    end

    # compares two {XdmAtomicValue}s using the underlying Saxon and XDM comparision rules
    # @param other [Saxon::XdmAtomicValue]
    # @return [Boolean]
    def ==(other)
      return false unless other.is_a?(XdmAtomicValue)
      s9_xdm_atomic_value.equals(other.to_java)
    end

    alias_method :eql?, :==

    def hash
      @hash ||= s9_xdm_atomic_value.hashCode
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
saxon-0.2.2-java lib/saxon/xdm_atomic_value.rb
saxon-0.2.1-java lib/saxon/xdm_atomic_value.rb
saxon-0.2.0-java lib/saxon/xdm_atomic_value.rb
saxon-0.1.0-java lib/saxon/xdm_atomic_value.rb