Skip to content

Instantly share code, notes, and snippets.

@capoferro
Created May 31, 2013 20:42
Show Gist options
  • Select an option

  • Save capoferro/5687836 to your computer and use it in GitHub Desktop.

Select an option

Save capoferro/5687836 to your computer and use it in GitHub Desktop.
require 'pp'
class A
def foo(x, y)
varargs = method(__method__).parameters.collect(&:last).collect { |var| eval var.to_s }
bar(*[__method__] + varargs)
end
def bar(*args)
puts __method__
puts args.inspect
end
end
a = A.new
a.foo('abc', 'def')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment