O
Oliver Saunders
If I declare
def foo(a, b)
end
What code should I use to find the names of the parameters?
I only see these methods available on a Method object.
["[]", "arity", "call", "to_proc", "unbind"]
For instance in PHP I could do this
function foo($a, $b) { }
$ref = new ReflectionFunction('foo')
$ref->getParameters()[0]->getName(); // a
$ref->getParameters()[1]->getName(); // b
def foo(a, b)
end
What code should I use to find the names of the parameters?
I only see these methods available on a Method object.
["[]", "arity", "call", "to_proc", "unbind"]
For instance in PHP I could do this
function foo($a, $b) { }
$ref = new ReflectionFunction('foo')
$ref->getParameters()[0]->getName(); // a
$ref->getParameters()[1]->getName(); // b