Class: Enumerator

Inherits:
Object
  • Object
show all
Defined in:
lib/pst/extensions.rb

Instance Method Summary collapse

Instance Method Details

#lazy_select(&block) ⇒ Object



2
3
4
5
6
7
8
# File 'lib/pst/extensions.rb', line 2

def lazy_select(&block)
  Enumerator.new do |yielder| 
    self.each do |val| 
      yielder.yield(val) if block.call(val) 
    end
  end 
end