Sha256: dcb673f1a3d51957868a77314ab0270deef6403d4af162ee97155c79ef75b170

Contents?: true

Size: 419 Bytes

Versions: 31

Compression:

Stored size: 419 Bytes

Contents

module PactBroker
  module Client
    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
end

Version data entries

31 entries across 31 versions & 1 rubygems

Version Path
pact_broker-client-1.60.0 lib/pact_broker/client/hash_refinements.rb
pact_broker-client-1.59.0 lib/pact_broker/client/hash_refinements.rb
pact_broker-client-1.58.0 lib/pact_broker/client/hash_refinements.rb
pact_broker-client-1.57.0 lib/pact_broker/client/hash_refinements.rb
pact_broker-client-1.56.0 lib/pact_broker/client/hash_refinements.rb
pact_broker-client-1.55.0 lib/pact_broker/client/hash_refinements.rb
pact_broker-client-1.54.0 lib/pact_broker/client/hash_refinements.rb
pact_broker-client-1.53.0 lib/pact_broker/client/hash_refinements.rb
pact_broker-client-1.52.0 lib/pact_broker/client/hash_refinements.rb
pact_broker-client-1.51.2 lib/pact_broker/client/hash_refinements.rb
pact_broker-client-1.51.1 lib/pact_broker/client/hash_refinements.rb
pact_broker-client-1.51.0 lib/pact_broker/client/hash_refinements.rb
pact_broker-client-1.50.0 lib/pact_broker/client/hash_refinements.rb
pact_broker-client-1.49.0 lib/pact_broker/client/hash_refinements.rb
pact_broker-client-1.48.0 lib/pact_broker/client/hash_refinements.rb
pact_broker-client-1.47.1 lib/pact_broker/client/hash_refinements.rb
pact_broker-client-1.47.0 lib/pact_broker/client/hash_refinements.rb
pact_broker-client-1.46.0 lib/pact_broker/client/hash_refinements.rb
pact_broker-client-1.45.0 lib/pact_broker/client/hash_refinements.rb
pact_broker-client-1.44.0 lib/pact_broker/client/hash_refinements.rb