Sha256: 52d66b53a510f3ba9df000e2b9a2ed10da9ff2bf4890b9642a94cac4a4111bfd

Contents?: true

Size: 386 Bytes

Versions: 1

Compression:

Stored size: 386 Bytes

Contents

module Contracts
  module Extensions
    module HashSubsetOf
      def subset_of?(other)
        (self.to_a - other.to_a).empty?
      end

      def normalize_keys
        self.inject({}) do |normalized, (key, value)|
          normalized[key.to_s.downcase] = value
          normalized
        end
      end
    end
  end
end

Hash.send(:include, Contracts::Extensions::HashSubsetOf)

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
contracts_api_test-0.0.1 lib/contracts/extensions.rb