Class: Hash

Inherits:
Object
  • Object
show all
Defined in:
lib/modern/core_ext/hash.rb

Instance Method Summary collapse

Instance Method Details

#deep_compact!Object



4
5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/modern/core_ext/hash.rb', line 4

def deep_compact!
  compact!

  each_value do |v|
    if v.is_a?(Hash) || v.respond_to?(:values)
      v.deep_compact!
    elsif v.is_a?(Array) || v.respond_to?(:each)
      v.deep_compact!
    end
  end

  self
end