Class: Calligraphy::XML::Node
- Inherits:
-
Object
- Object
- Calligraphy::XML::Node
- Defined in:
- lib/calligraphy/xml/node.rb
Overview
Simple XML node, used to store resource properties in Resource methods and later to create XML response bodies.
Instance Attribute Summary collapse
-
#children ⇒ Object
Returns the value of attribute children.
-
#name ⇒ Object
Returns the value of attribute name.
-
#namespace ⇒ Object
Returns the value of attribute namespace.
-
#text ⇒ Object
Returns the value of attribute text.
Instance Method Summary collapse
-
#initialize(node = nil) ⇒ Node
constructor
:nodoc:.
Constructor Details
#initialize(node = nil) ⇒ Node
:nodoc:
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/calligraphy/xml/node.rb', line 11 def initialize(node = nil) return if node.nil? @name = node.name @text = node.text unless node.text.empty? if node.namespace @namespace = Calligraphy::XML::Namespace.new node.namespace end return unless node_has_children node @children = [] node.children.each { |x| @children.push Calligraphy::XML::Node.new x } end |
Instance Attribute Details
#children ⇒ Object
Returns the value of attribute children.
8 9 10 |
# File 'lib/calligraphy/xml/node.rb', line 8 def children @children end |
#name ⇒ Object
Returns the value of attribute name.
8 9 10 |
# File 'lib/calligraphy/xml/node.rb', line 8 def name @name end |
#namespace ⇒ Object
Returns the value of attribute namespace.
8 9 10 |
# File 'lib/calligraphy/xml/node.rb', line 8 def namespace @namespace end |
#text ⇒ Object
Returns the value of attribute text.
8 9 10 |
# File 'lib/calligraphy/xml/node.rb', line 8 def text @text end |