Module: Enumerable
- Defined in:
- lib/lab419/core/enumerable.rb
Instance Method Summary collapse
Instance Method Details
#each_pair(options = {}, &blk) ⇒ Object
4 5 6 7 8 9 10 11 12 13 |
# File 'lib/lab419/core/enumerable.rb', line 4 def each_pair ={}, &blk if blk return Lab419::Enumerable::Pair.pairs self, , &blk end Enumerator.new do |y| Lab419::Enumerable::Pair.pairs self, do | pair | y.yield pair end end end |
#each_pair_with_rest(options = {}, &blk) ⇒ Object
15 16 17 18 19 20 21 22 23 24 |
# File 'lib/lab419/core/enumerable.rb', line 15 def each_pair_with_rest ={}, &blk if blk return Lab419::Enumerable::Pair.pairs_with_rest self, , &blk end Enumerator.new do |y| Lab419::Enumerable::Pair.pairs_with_rest self, do | pair_and_rest | y.yield pair_and_rest end end end |