File tree Expand file tree Collapse file tree
lib/kiba/extend/transforms Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -24,11 +24,19 @@ module Transforms
2424 # instance variable on which is also set an attr_reader (private
2525 # or public is ok)
2626 #
27- # Add the following line to the top of the `process` method:
27+ # Add the following line to the top of the `process` method if your lamba
28+ # takes a single argument:
2829 #
2930 # ~~~
3031 # test_lambda(row) unless lambda_tested
3132 # ~~~
33+ #
34+ # If your lambda takes multiple arguments, pass them in an Array in the
35+ # `test_lambda` call:
36+ #
37+ # ~~~
38+ # test_lambda([val, row]) unless lambda_tested
39+ # ~~~
3240 module BooleanLambdaParamable
3341 ::BooleanLambdaParamable =
3442 Kiba ::Extend ::Transforms ::BooleanLambdaParamable
@@ -39,8 +47,8 @@ def self.included(mod)
3947
4048 def lambda_tested = @lambda_tested
4149
42- def test_lambda ( row )
43- result = lambda . call ( row )
50+ def test_lambda ( args )
51+ result = args . is_a? ( Array ) ? lambda . call ( * args ) : lambda . call ( args )
4452 unless result . is_a? ( TrueClass ) || result . is_a? ( FalseClass )
4553 fail ( Kiba ::Extend ::BooleanReturningLambdaError )
4654 end
You can’t perform that action at this time.
0 commit comments