Sha256: 3c86e3a345a45c43ecc3ecf12ef6ed3ce4b3d4e861ed82c2c7840b72a3c6c72f

Contents?: true

Size: 284 Bytes

Versions: 6

Compression:

Stored size: 284 Bytes

Contents

# frozen_string_literal: true

class Hash
  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
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
modern-0.5.0 lib/modern/core_ext/hash.rb
modern-0.4.6 lib/modern/core_ext/hash.rb
modern-0.4.5 lib/modern/core_ext/hash.rb
modern-0.4.4 lib/modern/core_ext/hash.rb
modern-0.4.3 lib/modern/core_ext/hash.rb
modern-0.4.2 lib/modern/core_ext/hash.rb