Sha256: 9a275e9f713b2d28ffe1766b93b05eff7caad33d3970261998e8c6a1079f1b31

Contents?: true

Size: 363 Bytes

Versions: 8

Compression:

Stored size: 363 Bytes

Contents

module Pact
  module HashRefinements
    refine Hash do
      def compact
        h = {}
        each do |key, value|
          h[key] = value unless value == nil
        end
        h
      end unless Hash.method_defined? :compact

      def compact!
        reject! {|_key, value| value == nil}
      end unless Hash.method_defined? :compact!
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
pact-1.65.3 lib/pact/hash_refinements.rb
pact-1.65.2 lib/pact/hash_refinements.rb
pact-1.65.1 lib/pact/hash_refinements.rb
pact-1.65.0 lib/pact/hash_refinements.rb
pact-1.64.0 lib/pact/hash_refinements.rb
pact-1.63.0 lib/pact/hash_refinements.rb
pact-1.62.0 lib/pact/hash_refinements.rb
pact-1.61.0 lib/pact/hash_refinements.rb