From: matz@... (Yukihiro Matsumoto) Date: 2000-04-08T02:59:48+09:00 Subject: [ruby-talk:02379] Re: Iterator into array Hi, In message "[ruby-talk:02376] Iterator into array" on 00/04/07, Dave Thomas writes: |Dave's stupid question of the week: | |Given an iterator method, how can I get the results expressed as an |array? I could do: | | result = [] | iteratorMethod { |i| result << i } | |But this seems ugly - there must be a more functional way of doing this. Any |ideas? I think it may be uglier, but for the idea: def iterated_values(method, *args) result = [] method.call(*args) do |x| result.push(x) end result end p iterated_values([1,2].method(:each)) matz.