File tree Expand file tree Collapse file tree 1 file changed +8
-11
lines changed Expand file tree Collapse file tree 1 file changed +8
-11
lines changed Original file line number Diff line number Diff line change @@ -21,21 +21,18 @@ module Continuable
21
21
end
22
22
23
23
def step ( step_name , start : nil , &block )
24
- continuation . step ( step_name , start : start ) do |step |
25
- if block_given?
26
- block . call ( step )
27
- else
28
- step_method = method ( step_name )
24
+ unless block_given?
25
+ step_method = method ( step_name )
29
26
30
- raise ArgumentError , "Step method '#{ step_name } ' must accept 0 or 1 arguments" if step_method . arity > 1
27
+ raise ArgumentError , "Step method '#{ step_name } ' must accept 0 or 1 arguments" if step_method . arity > 1
31
28
32
- if step_method . parameters . any? { |type , name | type == :key || type == :keyreq }
33
- raise ArgumentError , "Step method '#{ step_name } ' must not accept keyword arguments"
34
- end
35
-
36
- step_method . arity == 0 ? step_method . call : step_method . call ( step )
29
+ if step_method . parameters . any? { |type , name | type == :key || type == :keyreq }
30
+ raise ArgumentError , "Step method '#{ step_name } ' must not accept keyword arguments"
37
31
end
32
+
33
+ block = step_method . arity == 0 ? -> ( _ ) { step_method . call } : step_method
38
34
end
35
+ continuation . step ( step_name , start : start , &block )
39
36
end
40
37
41
38
def serialize
You can’t perform that action at this time.
0 commit comments