Class: Wongi::Engine::AssertingTest
- Inherits:
-
FilterTest
- Object
- FilterTest
- Wongi::Engine::AssertingTest
- Defined in:
- lib/wongi-engine/filter/asserting_test.rb
Instance Method Summary collapse
-
#initialize(*vars, &body) ⇒ AssertingTest
constructor
A new instance of AssertingTest.
- #passes?(token) ⇒ Boolean
Methods inherited from FilterTest
Constructor Details
#initialize(*vars, &body) ⇒ AssertingTest
Returns a new instance of AssertingTest.
3 4 5 6 7 |
# File 'lib/wongi-engine/filter/asserting_test.rb', line 3 def initialize(*vars, &body) super() @vars = vars @body = body end |
Instance Method Details
#passes?(token) ⇒ Boolean
9 10 11 12 13 14 15 |
# File 'lib/wongi-engine/filter/asserting_test.rb', line 9 def passes?(token) if @vars.empty? @body.call token else @body.call(*(@vars.map { |var| token[var] })) end end |