Class: Waves::Matchers::Base
Instance Attribute Summary collapse
-
#constraints ⇒ Object
Returns the value of attribute constraints.
Instance Method Summary collapse
- #[](*args) ⇒ Object
-
#test(request) ⇒ Object
used to provide consisting matching logic across all matchers.
Instance Attribute Details
#constraints ⇒ Object
Returns the value of attribute constraints.
7 8 9 |
# File 'lib/matchers/base.rb', line 7 def constraints @constraints end |
Instance Method Details
#[](*args) ⇒ Object
9 |
# File 'lib/matchers/base.rb', line 9 def []( *args ) ; call( *args ) ; end |
#test(request) ⇒ Object
used to provide consisting matching logic across all matchers
12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/matchers/base.rb', line 12 def test( request ) constraints.all? do | key, val | if val.nil? or val == true true else if val.respond_to? :call val.call( request ) else val == request.send( key ) or val === request.send( key ) or request.send( key ) === val end end end end |