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 options={}, &blk
  if blk 
    return Lab419::Enumerable::Pair.pairs self, options, &blk
  end
  Enumerator.new do |y|
    Lab419::Enumerable::Pair.pairs self, options 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 options={}, &blk
  if blk
    return Lab419::Enumerable::Pair.pairs_with_rest self, options, &blk
  end
  Enumerator.new do |y|
    Lab419::Enumerable::Pair.pairs_with_rest self, options do | pair_and_rest |
      y.yield pair_and_rest
    end
  end
end