Method: Calligraphy::XML::Node#initialize
- Defined in:
- lib/calligraphy/xml/node.rb
#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 |