Module: Xeroizer::Report::CellXmlHelper::ClassMethods
- Defined in:
- lib/xeroizer/report/cell_xml_helper.rb
Instance Method Summary collapse
-
#build_from_node(node) ⇒ Object
Create an instance of Cell from the node.
Instance Method Details
#build_from_node(node) ⇒ Object
Create an instance of Cell from the node.
Additionally, parse the attributes and return them as a hash to the cell. If a cell’s attributes look like:
<Attributes>
<Attribute>
<Value>1335b8b2-4d63-4af8-937f-04087ae2e36e</Value>
<Id>account</Id>
</Attribute>
</Attributes>
Return a hash like:
{
'account' => '1335b8b2-4d63-4af8-937f-04087ae2e36e'
}
31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/xeroizer/report/cell_xml_helper.rb', line 31 def build_from_node(node) cell = new node.elements.each do | element | case element.name.to_s when 'Value' then cell.value = parse_value(element.text) when 'Attributes' element.elements.each do | attribute_node | (id, value) = parse_attribute(attribute_node) cell.attributes[id] = value end end end cell end |