Class: Wongi::Engine::AssertingTest

Inherits:
FilterTest show all
Defined in:
lib/wongi-engine/filter/asserting_test.rb

Instance Method Summary collapse

Methods inherited from FilterTest

#==, #compile

Constructor Details

#initialize(*vars, &body) ⇒ AssertingTest

Returns a new instance of AssertingTest.



5
6
7
8
# File 'lib/wongi-engine/filter/asserting_test.rb', line 5

def initialize *vars, &body
  @vars = vars
  @body = body
end

Instance Method Details

#passes?(token) ⇒ Boolean

Returns:

  • (Boolean)


10
11
12
13
14
15
16
# File 'lib/wongi-engine/filter/asserting_test.rb', line 10

def passes? token
  if @vars.empty?
    @body.call token
  else
    @body.call *( @vars.map { |var| token[var] } )
  end
end