class Pod::Generate::Configuration::HashOf

@visibility private

Implements `===` to do type checking against a hash.

Attributes

key_types[R]
value_types[R]

Public Class Methods

new(keys:, values:) click to toggle source
# File lib/cocoapods/generate/configuration.rb, line 91
def initialize(keys:, values:)
  @key_types = keys
  @value_types = values
end

Public Instance Methods

===(other) click to toggle source

@return [Boolean] whether the given object is a hash with elements all of the given types

# File lib/cocoapods/generate/configuration.rb, line 102
def ===(other)
  other.is_a?(Hash) && other.all? do |key, value|
    key_types.any? { |t| t === key } &&
      value_types.any? { |t| t === value }
  end
end
to_s() click to toggle source
# File lib/cocoapods/generate/configuration.rb, line 96
def to_s
  "Hash<#{key_types.join('|')} => #{value_types.join('|')}}>"
end