Class: XmlHasher::Node
- Inherits:
-
Object
- Object
- XmlHasher::Node
- Defined in:
- lib/xmlhasher/node.rb
Instance Attribute Summary collapse
-
#attributes ⇒ Object
Returns the value of attribute attributes.
-
#children ⇒ Object
Returns the value of attribute children.
-
#name ⇒ Object
Returns the value of attribute name.
-
#text ⇒ Object
Returns the value of attribute text.
Instance Method Summary collapse
-
#initialize(name) ⇒ Node
constructor
A new instance of Node.
- #to_hash ⇒ Object
Constructor Details
#initialize(name) ⇒ Node
Returns a new instance of Node.
7 8 9 10 11 |
# File 'lib/xmlhasher/node.rb', line 7 def initialize(name) @name = name @attributes = {} @children = [] end |
Instance Attribute Details
#attributes ⇒ Object
Returns the value of attribute attributes.
5 6 7 |
# File 'lib/xmlhasher/node.rb', line 5 def attributes @attributes end |
#children ⇒ Object
Returns the value of attribute children.
5 6 7 |
# File 'lib/xmlhasher/node.rb', line 5 def children @children end |
#name ⇒ Object
Returns the value of attribute name.
5 6 7 |
# File 'lib/xmlhasher/node.rb', line 5 def name @name end |
#text ⇒ Object
Returns the value of attribute text.
5 6 7 |
# File 'lib/xmlhasher/node.rb', line 5 def text @text end |
Instance Method Details
#to_hash ⇒ Object
13 14 15 16 |
# File 'lib/xmlhasher/node.rb', line 13 def to_hash node_content = content { name => node_content.empty? ? nil : node_content } end |