Sha256: ad5046fcbba6edf96409a8860a71cd46485d76444a776a85dc64363a4574704c

Contents?: true

Size: 417 Bytes

Versions: 19

Compression:

Stored size: 417 Bytes

Contents

module Timber
  module Util
    # @private
    module Hash
      extend self

      def deep_compact(hash)
        new_hash = {}

        hash.each do |k, v|
          v = if v.is_a?(::Hash)
            deep_compact(v)
          else
            v
          end

          if v != nil && v != "" && v != {} && v != []
            new_hash[k] = v
          end
        end

        new_hash
      end
    end
  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
timber-2.0.8 lib/timber/util/hash.rb
timber-2.0.7 lib/timber/util/hash.rb
timber-2.0.6 lib/timber/util/hash.rb
timber-2.0.5 lib/timber/util/hash.rb
timber-2.0.4 lib/timber/util/hash.rb
timber-2.0.3 lib/timber/util/hash.rb
timber-2.0.2 lib/timber/util/hash.rb
timber-2.0.1 lib/timber/util/hash.rb
timber-2.0.0 lib/timber/util/hash.rb
timber-1.1.14 lib/timber/util/hash.rb
timber-1.1.13 lib/timber/util/hash.rb
timber-1.1.12 lib/timber/util/hash.rb
timber-1.1.11 lib/timber/util/hash.rb
timber-1.1.10 lib/timber/util/hash.rb
timber-1.1.9 lib/timber/util/hash.rb
timber-1.1.8 lib/timber/util/hash.rb
timber-1.1.7 lib/timber/util/hash.rb
timber-1.1.6 lib/timber/util/hash.rb
timber-1.1.5 lib/timber/util/hash.rb