T
Trans
This came up in an earlier thread. On occasion I run into situations
where I'd like to pass arguments from one method to another in an
"argument-per-argument" fashion. Take a look at the following:
| def give
| return [:a,:b,:c]
| end
|
| def give_each
| return *[:a,:b,:c]
| end
|
| def take(*args)
| p *args
| end
|
| takea,:b,:c)
| :a
| :b
| :c
|
| take(give)
| [:a, :b, :c]
|
| take(give_each)
| [:a, :b, :c]
I'm interested in the last exmple being like the first. I.e.
| take(give_each)
| :a
| :b
| :c
Which I am calling argument-per-argument passing.
What is the feasibility of this?
Thanks,
T.
where I'd like to pass arguments from one method to another in an
"argument-per-argument" fashion. Take a look at the following:
| def give
| return [:a,:b,:c]
| end
|
| def give_each
| return *[:a,:b,:c]
| end
|
| def take(*args)
| p *args
| end
|
| takea,:b,:c)
| :a
| :b
| :c
|
| take(give)
| [:a, :b, :c]
|
| take(give_each)
| [:a, :b, :c]
I'm interested in the last exmple being like the first. I.e.
| take(give_each)
| :a
| :b
| :c
Which I am calling argument-per-argument passing.
What is the feasibility of this?
Thanks,
T.