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
On Jul 3, 2008, at 1:43 PM, Oliver Saunders wrote:
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
-- Posted via http://www.ruby-forum.com/\.
--
we can deny everything, except that we have the possibility of being better. simply reflect on that.
h.h. the 14th dalai lama
bad idea ihmo - it'll be almost impossible to map valid http request names to ruby vars, for instance you'll have
'a var with a space' #=> ??
'a var with a /' #=> ??
etc etc
in addition the only way you can do that is with a heavy duty eval process (vars set by eval are only available to further evals) which makes for a super slow request loop. so this sounds like it'll end up being a huge stack of evals - not metaprogramming - unless i'm misunderstanding. can you sketch out an example of what you'd like to do for us?