Created
May 31, 2013 20:42
-
-
Save capoferro/5687836 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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