totally_lazy 0.1.51 → 0.1.52
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/lib/totally_lazy/sequence.rb +7 -0
- data/spec/totally_lazy/sequence_spec.rb +4 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
Y2NkOTk0YzkwOGE5NTgwMjI3MzA4NTdlNGEwZDgyZmYxODQ2ZjE4MA==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
NTgzYWNiNmEyM2I4M2IzOWM3YWE4NGZhMjY3ZDI3MDE2OWRkMjM4Zg==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
Y2YwMmU2Mzg0YWEzZWJjYWI5NzAyYzhkYzdiYzQ5YzYzOTFlYmU4OTRhMTQz
|
10
|
+
MjQzMzExYTQ0OWFkNWNiZjk4YWQ5OGE2MzRmZTU1ZDZjMjcwODNhNzNiMDU1
|
11
|
+
Y2EyNmQ1ZDhmODI4NGY2ZDcxYjIzZDc2M2EyYWQ0MDBkOGFiMzE=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
NGYyMGVkMmVmZjMwMGZmM2JmOGUxNGMyNmFmYzgyODk4ZTIwNWIwZjExMjIy
|
14
|
+
NDBkMjBkZWYxOTRmNzU1YzEwMzI2MzBlNGJlZDY0ZTE5ODA2YzZiMmI3MGU3
|
15
|
+
NTM0YjFiYmQ0YTQ5NzZkYzAyOGRhODljMmJjNDNhZGU0ZjhmYjE=
|
@@ -304,6 +304,13 @@ class Sequence
|
|
304
304
|
Sequence.new(@enumerator.to_a.lazy)
|
305
305
|
end
|
306
306
|
|
307
|
+
def join(other)
|
308
|
+
Sequence.new(Enumerator.new do |y|
|
309
|
+
@enumerator.each { |value| y << value }
|
310
|
+
other.enumerator.each { |value| y << value }
|
311
|
+
end.lazy)
|
312
|
+
end
|
313
|
+
|
307
314
|
def to_a
|
308
315
|
@enumerator.to_a
|
309
316
|
end
|
@@ -301,6 +301,10 @@ describe 'Sequence' do
|
|
301
301
|
expect(sequence(sequence(1)).flatten.to_s).to eq('[1]')
|
302
302
|
end
|
303
303
|
|
304
|
+
it 'should support join' do
|
305
|
+
expect(sequence(1,2,3).join(sequence(4,5,6))).to eq(sequence(1,2,3,4,5,6))
|
306
|
+
end
|
307
|
+
|
304
308
|
it 'should raise exception if you try to use both lambda and block' do
|
305
309
|
expect { empty.map(->(a) { a+1 }) { |b| b+2 } }.to raise_error(RuntimeError)
|
306
310
|
expect { empty.map_concurrently(->(a) { a+1 }) { |b| b+2 } }.to raise_error(RuntimeError)
|