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