lib/axlsx/util/serialized_attributes.rb
# serialized instance values at text nodes on a camelized element of the
# attribute name. You may pass in a block for evaluation against non nil
# values. We use an array for element attributes becuase misordering will
# break the xml and 1.8.7 does not support ordered hashes.
# @param [String] str The string instance to which serialized data is appended
# @param [Array] additional_attributes An array of additional attribute names.
# @param [Proc] block A which will be called with the value for each element.
# @return [String] The serialized output.
serialized instance values at text nodes on a camelized element of the
attribute name. You may pass in a block for evaluation against non nil
values. We use an array for element attributes becuase misordering will
break the xml and 1.8.7 does not support ordered hashes.
serialized instance values at text nodes on a camelized element of the attribute name . You may pass in a block for evaluation against non nil values . We use an array for element attributes becuase misordering will break the xml and 1 . 8 . 7 does not support ordered hashes .
def serialized_element_attributes(str='', additional_attributes=[], &block)
      attrs = self.class.xml_element_attributes + additional_attributes
      values = instance_values
      attrs.each do |attribute_name|
        value = values[attribute_name.to_s]
        next if value.nil?
        value = yield value if block_given?
        element_name = Axlsx.camel(attribute_name, false)
        str << "<#{element_name}>#{value}</#{element_name}>"
      end
      str
    end
def serialized_element_attributes ( str = '' , additional_attributes = [ ] , & block ) attrs = self . class . xml_element_attributes + additional_attributes values = instance_values attrs . each do | attribute_name | value = values [ attribute_name . to_s ] next if value . nil? value = yield value if block_given? element_name = Axlsx . camel ( attribute_name , false ) str << "<#{element_name}>#{value}</#{element_name}>" end str end
serialized instance values at text nodes on a camelized element of the
attribute name.
serialized instance values at text nodes on a camelized element of the attribute name .
The serialized output.
The serialized output .
String
str
additional_attributes
block
block A which will be called with the value for each element.
block A which will be called with the value for each element .