Classes which include Denumerable will get versions of map, select, and so on, which return a Denumerator, so that they work horizontally without creating intermediate arrays.
@author Brian Candler @author Trans
# File lib/facets/denumerable.rb, line 14 def map Denumerator.new do |output| each do |*input| output.yield yield(*input) end end end
# File lib/facets/denumerable.rb, line 34 def reject Denumerator.new do |output| each do |*input| output.yield(*input) unless yield(*input) end end end
# File lib/facets/denumerable.rb, line 24 def select Denumerator.new do |output| each do |*input| output.yield(*input) if yield(*input) end end end
Generated with the Darkfish Rdoc Generator 2.