Class: Array

Inherits:
Object show all
Defined in:
lib/rapuncel/core_ext/array.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.from_xml_rpc(xml_node) ⇒ Object



20
21
22
23
24
25
26
27
28
29
# File 'lib/rapuncel/core_ext/array.rb', line 20

def self.from_xml_rpc xml_node
  #warn "Warning: This is not an array-node (It is a(n) #{xml_node.name}.). Parsing may go wrong. Continuing at your risk" unless ['array'].include? xml_node.name.downcase
  
  
  values = xml_node.first_element_child.element_children #xpath('./data/value/*')
  
  values.map do |value|
    Object.from_xml_rpc value.first_element_child
  end    
end

Instance Method Details

#to_xml_rpc(b = Rapuncel.get_builder) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/rapuncel/core_ext/array.rb', line 6

def to_xml_rpc b = Rapuncel.get_builder

  b.array do
    b.data do
      each do |array_entry|
        b.value do
          array_entry.to_xml_rpc b
        end
      end
    end
  end
end