Class: FreshBooks::XmlSerializer::ArraySerializer
- Inherits:
-
Object
- Object
- FreshBooks::XmlSerializer::ArraySerializer
- Defined in:
- lib/freshbooks/xml_serializer/serializers.rb
Class Method Summary collapse
Class Method Details
.to_node(member_name, value) ⇒ Object
80 81 82 83 84 85 86 |
# File 'lib/freshbooks/xml_serializer/serializers.rb', line 80 def self.to_node(member_name, value) element = REXML::Element.new(member_name) value.each { |array_elem| element.add_element(REXML::Document.new(array_elem.to_xml)) } element end |
.to_value(xml_val) ⇒ Object
88 89 90 91 92 |
# File 'lib/freshbooks/xml_serializer/serializers.rb', line 88 def self.to_value(xml_val) xml_val.elements.map { |elem| FreshBooks::const_get(elem.name.camelize)::new_from_xml(elem) } end |