lib/vagrant-invade/extend.rb in vagrant-invade-0.6.4 vs lib/vagrant-invade/extend.rb in vagrant-invade-0.7.0
- old
+ new
@@ -6,12 +6,15 @@
d += 1
end
d
end
- def delete_blank
- delete_if do |_, v|
- (v.respond_to?(:empty?) ? v.empty? : !v) or v.instance_of?(Hash) && v.delete_blank.empty?
+ def compact(opts={})
+ inject({}) do |new_hash, (k,v)|
+ if !v.nil?
+ new_hash[k] = opts[:recurse] && v.class == Hash ? v.compact(opts) : v
+ end
+ new_hash
end
end
end
class Array