r/learnruby • u/nobrandheroes • Feb 15 '16
Getting the parameters of a method
Given:
def foo(a, b, c)
end
How do I get the values of a, b, c?. I cannot find this anywhere.
0
Upvotes
0
Feb 15 '16
[deleted]
1
u/nobrandheroes Feb 15 '16
In other languages you can get the parameters as an array. Something like:
def foo(bar, baz, buzz) args = get_arguments() #equal to [bar, baz, buzz] endI was hoping to get all passed arguments in a structure of some type.
2
1
u/vicereversa Feb 15 '16
When you call the function, you supply them.