lib/ruote/util/deep.rb in ruote-2.3.0.1 vs lib/ruote/util/deep.rb in ruote-2.3.0.2
- old
+ new
@@ -1,7 +1,7 @@
#--
-# Copyright (c) 2005-2012, John Mettraux, jmettraux@gmail.com
+# Copyright (c) 2005-2013, John Mettraux, jmettraux@gmail.com
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
@@ -109,10 +109,11 @@
coll.dup.each do |k, v|
# ensure that all keys are strings
unless k.is_a?(String)
+
coll.delete(k)
k = k.to_s
coll[k] = v
end
@@ -123,11 +124,12 @@
if block.arity > 3
block.call(parent, coll, k, v)
else
block.call(coll, k, v)
end
+ end
- elsif v.is_a?(Array) || v.is_a?(Hash)
+ if v.is_a?(Array) || v.is_a?(Hash)
deep_mutate(v, keys, coll, &block)
end
end