b-lazy 0.0.2 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. data/lib/b-lazy.rb +18 -1
  2. metadata +2 -2
data/lib/b-lazy.rb CHANGED
@@ -36,6 +36,20 @@ module Enumerable
36
36
  end
37
37
 
38
38
 
39
+ # This is similar to the tap method. It allows you
40
+ # to examine each item as it passes through the
41
+ # Enumeration pipeline. It is also handy if you want
42
+ # to modify an element's state as it passes through.
43
+ def touch(&blk)
44
+ Enumerator.new do |out|
45
+ self.each do |x|
46
+ blk.call x
47
+ out.yield x
48
+ end
49
+ end
50
+ end
51
+
52
+
39
53
  def lselect(&blk)
40
54
  Enumerator.new do |out|
41
55
  self.each do |i|
@@ -164,7 +178,7 @@ module Enumerable
164
178
 
165
179
  # The first time through, we will gradually collect all
166
180
  # of self's enumerators into an Array.
167
- self.each do |e|
181
+ s.lmap{|e| e.to_enum}.each do |e|
168
182
  if e.has_next?
169
183
  enums << e
170
184
  out.yield e.next
@@ -188,5 +202,8 @@ module Enumerable
188
202
 
189
203
  end
190
204
  end
205
+
206
+
207
+
191
208
 
192
209
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 0
8
- - 2
9
- version: 0.0.2
8
+ - 3
9
+ version: 0.0.3
10
10
  platform: ruby
11
11
  authors:
12
12
  - Brian Lauber