Class: AngryWeb::HashSubsetMatcher

Inherits:
ValueMatcher show all
Defined in:
lib/angry_web/matcher.rb

Instance Attribute Summary

Attributes inherited from ValueMatcher

#mismatch_reason

Instance Method Summary collapse

Methods inherited from ValueMatcher

#initialize

Constructor Details

This class inherits a constructor from AngryWeb::ValueMatcher

Instance Method Details

#match?(params) ⇒ Boolean

Returns:

  • (Boolean)


23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/angry_web/matcher.rb', line 23

def match?(params)
  @value.keys.all? do |k|
    match = @value[k]
    param = params[k.to_s]

    case match
    when Regexp
      !! param[match]
    else
      match == param
    end
  end
end