Sha256: eb76bf7191bbf99f1c49d53e876a8e16b752ef5995f09566eb45a5ed420f8c68

Contents?: true

Size: 341 Bytes

Versions: 1

Compression:

Stored size: 341 Bytes

Contents

module Timber
  module Macros
    module Compactor
      def self.compact(hash)
        new_hash = {}
        hash.each do |k, v|
          deep_v = v.is_a?(Hash) ? compact(v) : v
          if !deep_v.nil? && deep_v != [] && deep_v != {}
            new_hash[k] = deep_v
          end
        end
        new_hash
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
timberio-1.0.0.beta1 lib/timber/macros/compactor.rb