Class: Waves::Matchers::Query
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
- #call(request) ⇒ Object
-
#initialize(pattern) ⇒ Query
constructor
A new instance of Query.
Methods inherited from Base
Constructor Details
#initialize(pattern) ⇒ Query
Returns a new instance of Query.
7 |
# File 'lib/matchers/query.rb', line 7 def initialize( pattern ) ; @pattern = ( pattern or {} ) ; end |
Instance Method Details
#call(request) ⇒ Object
9 10 11 12 13 14 15 |
# File 'lib/matchers/query.rb', line 9 def call( request ) @pattern.all? do | key, val | key = key.to_s ( ( val.respond_to?(:call) and val.call( request.query[ key ] ) ) or ( request.query[ key ] and ( ( val == true ) or ( val === request.query[ key ] ) ) ) ) end end |