Skip to content

Commit 6565294

Browse files
committed
Get rid of an useless frame in AJ::Continuable#step
1 parent 4a38e91 commit 6565294

File tree

1 file changed

+8
-11
lines changed

1 file changed

+8
-11
lines changed

activejob/lib/active_job/continuable.rb

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -21,21 +21,18 @@ module Continuable
2121
end
2222

2323
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)
2926

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
3128

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"
3731
end
32+
33+
block = step_method.arity == 0 ? -> (_) { step_method.call } : step_method
3834
end
35+
continuation.step(step_name, start: start, &block)
3936
end
4037

4138
def serialize

0 commit comments

Comments
 (0)