lib/ass_ole/snippets/shared/mapped.rb in ass_ole-snippets-shared-0.3.0 vs lib/ass_ole/snippets/shared/mapped.rb in ass_ole-snippets-shared-0.3.1
- old
+ new
@@ -5,10 +5,16 @@
# @api private
def self.mapped_mixin(module_)
module_.instance_eval do
define_method :_hash_to_object do |hash_, object_|
hash_.each_with_object(object_) do |k_v, obj|
- obj.Insert((k_v[0].is_a?(Symbol) ? k_v[0].to_s : k_v[0]), k_v[1])
+ key = (k_v[0].is_a?(Symbol) ? k_v[0].to_s : k_v[0])
+ value = k_v[1]
+ if value.nil?
+ obj.Insert(key)
+ else
+ obj.Insert(key, value)
+ end
end
end
private :_hash_to_object
end
end