Class: Ox::Node

Inherits:
Object
  • Object
show all
Defined in:
lib/ox/node.rb

Overview

The Node is the base class for all other in the Ox module.

Direct Known Subclasses

CData, Comment, DocType, Element, Instruct, Raw

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(value) ⇒ Node

Creates a new Node with the specified String value.

  • value [String] string value for the Node



10
11
12
# File 'lib/ox/node.rb', line 10

def initialize(value)
  @value = value.to_s
end

Instance Attribute Details

#valueObject

String value associated with the Node.



6
7
8
# File 'lib/ox/node.rb', line 6

def value
  @value
end

Instance Method Details

#eql?(other) ⇒ Boolean Also known as: ==

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.

Returns:

  • (Boolean)


17
18
19
20
# File 'lib/ox/node.rb', line 17

def eql?(other)
  return false if (other.nil? or self.class != other.class)
  other.value == self.value
end