From: Roger Pack Date: 2009-10-03T23:31:04+09:00 Subject: Re: Backporting Enumerator.new { ... } to Ruby 1.8.7 > sensibly under Ruby 1.9 as of now). Unfortunately, my code heavily uses > lazy-evaluated, nested Enumerator objects. What is the sanest way to > backport the following example so that it works more-or-less in the same > way under Ruby 1.8.7 as it does under Ruby 1.9? looks like there's a couple ways one require 'backports' # leave the original code as is or this one require 'generator' def multiplier param Generator.new do |yielder| (1..10).each do |elem| sleep 1 # simulates a long-running process yielder.yield param * elem end end end multiplier(3).each do |e| puts e end I'm not sure if that will actually satisfy your desire (nor have I figured out if enumerables are really "chainable" in 1.8 like they apparently are in 1.9). Thanks! -r -- Posted via http://www.ruby-forum.com/.