I want to get the names of the arguments that are passed into a method.
Example:
def my_method(first, second, third)
puts
end
my_method 1, 2, 3
Should output:
first
second
third
Is there any way to do this?
irb(main):021:0> def my_method(first,second,third)
irb(main):022:1> puts local_variables
irb(main):023:1> end
nil
irb(main):024:0> my_method(1,2,3)
first
second
third
(give or take hidden pitfalls, and of course the question I dare not
ask, which is why one would want to do this
I want to get the names of the arguments that are passed into a method.
Example:
def my_method(first, second, third)
puts
end
my_method 1, 2, 3
Should output:
first
second
third
Is there any way to do this?
irb(main):021:0> def my_method(first,second,third)
irb(main):022:1> puts local_variables
irb(main):023:1> end
nil
irb(main):024:0> my_method(1,2,3)
first
second
third
(give or take hidden pitfalls, and of course the question I dare not
ask, which is why one would want to do this
I want to get the names of the arguments that are passed into a
method.
Example:
def my_method(first, second, third)
puts
end
my_method 1, 2, 3
Should output:
first
second
third
Is there any way to do this?
irb(main):021:0> def my_method(first,second,third)
irb(main):022:1> puts local_variables
irb(main):023:1> end
nil
irb(main):024:0> my_method(1,2,3)
first
second
third
(give or take hidden pitfalls, and of course the question I dare not
ask, which is why one would want to do this