Module: Facturapi::Xml

Defined in:
lib/facturapi/xml.rb

Instance Method Summary collapse

Instance Method Details

#create_node(name, attributes = nil) {|node| ... } ⇒ Object

Yields:

  • (node)


5
6
7
8
9
10
11
12
13
14
15
# File 'lib/facturapi/xml.rb', line 5

def create_node(name, attributes = nil)
  node = XML::Node.new(name)

  if attributes
    attributes.each do |k, v|
      XML::Attr.new(node, k.to_s, v)
    end
  end
  yield(node) if block_given?
  node
end