Reputation: 15872
Suppose I have this method:
def person(name: "calvin")
...
end
I want to find the default value for param name
. How would I do that?
Upvotes: 2
Views: 108
Reputation: 80065
There is no list of parameter defaults, a default value is code that is executed.
def foo(t=Time.now)
p t
end
foo #2015-04-20 19:43:54 +0200
sleep 1
foo #2015-04-20 19:43:55 +0200
Upvotes: 3
Reputation: 3870
Not sure whether this will help, but person.send(:local_variables)
might be a good starting point.
Upvotes: 0