From 87560296ccb05a4fb21461bc64aead272a5839b7 Mon Sep 17 00:00:00 2001 From: Randy Morgan Date: Sun, 14 Oct 2012 09:45:46 +0900 Subject: Patched serialized_attributes for 1.8.7 I really need to discontinue support for 1.8.7... --- lib/axlsx/util/serialized_attributes.rb | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/axlsx/util/serialized_attributes.rb b/lib/axlsx/util/serialized_attributes.rb index 85a7feba..59efbc9f 100644 --- a/lib/axlsx/util/serialized_attributes.rb +++ b/lib/axlsx/util/serialized_attributes.rb @@ -16,10 +16,13 @@ module Axlsx end def serialized_attributes(str = '', additional_attributes = {}) - key_value_pairs = instance_values.select do |key, value| - self.class.xml_attributes.include?(key.to_sym) && value != nil + key_value_pairs = instance_values + key_value_pairs.each do |key, value| + key_value_pairs.delete(key) if value == nil + key_value_pairs.delete(key) unless self.class.xml_attributes.include?(key.to_sym) end key_value_pairs.merge! additional_attributes + key_value_pairs.each do |key, value| str << "#{Axlsx.camel(key, false)}='#{value}' " end -- cgit v1.2.3