Method: Ardm::Hook::ClassMethods#args_for

Defined in:
lib/ardm/support/hook.rb

#args_for(method) ⇒ Object

— Helpers —



379
380
381
382
383
384
385
386
387
388
389
# File 'lib/ardm/support/hook.rb', line 379

def args_for(method)
  if method.arity == 0
    "&block"
  elsif method.arity > 0
    "_" << (1 .. method.arity).to_a.join(", _") << ", &block"
  elsif (method.arity + 1) < 0
    "_" << (1 .. (method.arity).abs - 1).to_a.join(", _") << ", *args, &block"
  else
    "*args, &block"
  end
end