lib/xeroizer/report/cell_xml_helper.rb in xeroizer-2.19.0 vs lib/xeroizer/report/cell_xml_helper.rb in xeroizer-2.20.0

- old
+ new

@@ -1,30 +1,30 @@ module Xeroizer module Report module CellXmlHelper - + def self.included(base) base.extend(ClassMethods) base.send :include, InstanceMethods end - + module ClassMethods - + public - + # Create an instance of Cell from the node. # - # Additionally, parse the attributes and return them as a hash to the + # 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' # } @@ -40,21 +40,21 @@ end end end cell end - + protected def parse_value(value) case value - when /^[-]?\d+(\.\d+)?$/ then BigDecimal(value) - when /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}$/ then Time.xmlschema(value) - else value + when /\A[-]?\d+(\.\d+)?\z/ then BigDecimal(value) + when /\A\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\z/ then Time.xmlschema(value) + else value end end - + def parse_attribute(attribute_node) id = nil value = nil attribute_node.elements.each do | element | case element.name.to_s @@ -63,12 +63,12 @@ end end [id, value] end end - + module InstanceMethods end - + end end end