Skip to content

Commit

Permalink
DRY up the proc extension.
Browse files Browse the repository at this point in the history
  • Loading branch information
tmak committed Nov 12, 2008
1 parent f73737c commit f97bf75
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions lib/cucumber/core_ext/proc.rb
Expand Up @@ -10,10 +10,9 @@ module CallIn


def call_in(obj, *args) def call_in(obj, *args)
obj.extend(mod) obj.extend(mod)
a = arity == -1 ? 0 : arity if self != StepMother::PENDING && args.length != arity2
if self != StepMother::PENDING && args.length != a
# We have to manually raise when the block has arity -1 (no pipes) # We have to manually raise when the block has arity -1 (no pipes)
raise ArityMismatchError.new("expected #{arity == -1 ? 0 : arity} block argument(s), got #{args.length}") raise ArityMismatchError.new("expected #{arity2} block argument(s), got #{args.length}")
else else
obj.__send__(meth, *args) obj.__send__(meth, *args)
end end
Expand Down

0 comments on commit f97bf75

Please sign in to comment.