File: node.rb

package info (click to toggle)
ruby-ox 2.1.1-2%2Bdeb9u1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 540 kB
  • sloc: ansic: 7,178; ruby: 415; makefile: 2
file content (24 lines) | stat: -rw-r--r-- 687 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24

module Ox
  # The Node is the base class for all other in the Ox module.
  class Node
    # String value associated with the Node.
    attr_accessor :value
    
    # Creates a new Node with the specified String value.
    # @param [String] value string value for the Node
    def initialize(value)
      @value = value.to_s
    end

    # Returns true if this Object and other are of the same type and have the
    # equivalent value otherwise false is returned.
    # @param [Object] other Object to compare _self_ to.
    def eql?(other)
      return false if (other.nil? or self.class != other.class)
      other.value == self.value
    end
    alias == eql?

  end # Node
end # Ox