File: node.rb

package info (click to toggle)
ruby-ox 2.14.23-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 3,504 kB
  • sloc: xml: 39,683; ansic: 9,626; ruby: 6,441; sh: 47; makefile: 2
file content (23 lines) | stat: -rw-r--r-- 671 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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.
    # - +value+ [String] 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.
    # - +other+ [Object] Object to compare _self_ to.
    def eql?(other)
      return false if (other.nil? or self.class != other.class)

      other.value == value
    end
    alias == eql?
  end # Node
end # Ox