Class: Muack::Where

Inherits:
Satisfying show all
Defined in:
lib/muack/satisfying.rb

Direct Known Subclasses

Allowing, Having

Constant Summary collapse

None =
Object.new

Instance Attribute Summary

Attributes inherited from Satisfying

#api_args, #block

Instance Method Summary collapse

Methods inherited from Satisfying

#&, #api_name, #to_s, #|

Constructor Details

#initialize(spec) ⇒ Where

Returns a new instance of Where.



120
121
122
# File 'lib/muack/satisfying.rb', line 120

def initialize spec
  super([spec])
end

Instance Method Details

#match(actual_arg, spec = api_args.first) ⇒ Object



124
125
126
127
128
129
130
131
132
133
# File 'lib/muack/satisfying.rb', line 124

def match actual_arg, spec=api_args.first
  case spec
  when Hash
    actual_arg.kind_of?(Hash) && match_hash(actual_arg, spec)
  when Array
    actual_arg.kind_of?(Array) && match_array(actual_arg, spec)
  else
    raise UnknownSpec.new(spec)
  end
end