Module: Contracts::Extensions::HashSubsetOf

Defined in:
lib/contracts/extensions.rb

Instance Method Summary collapse

Instance Method Details

#normalize_keysObject



8
9
10
11
12
13
# File 'lib/contracts/extensions.rb', line 8

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

#subset_of?(other) ⇒ Boolean

Returns:

  • (Boolean)


4
5
6
# File 'lib/contracts/extensions.rb', line 4

def subset_of?(other)
  (self.to_a - other.to_a).empty?
end