class Stannum::Constraints::Parameters::ExtraKeywords

Validates that the keywords passed to a method have no extra keys.

@example

keys       = %[fuel mass size]
constraint = Stannum::Constraints::Parameters::ExpectedKeywords.new(keys)

constraint.matches?({})                                #=> true
constraint.matches?({ fuel: 'Monopropellant' })        #=> true
constraint.matches?({ electric: true, fuel: 'Xenon' }) #=> false
constraint.matches?({ fuel: 'LF/O', mass: '1 ton', size: 'Medium' })
#=> true
constraint.matches?(
  { fuel: 'LF', mass: '2 tons', nuclear: true, size: 'Medium' }
)
#=> false

Constants

NEGATED_TYPE

The :type of the error generated for a matching object.

TYPE

The :type of the error generated for a non-matching object.