totally_lazy 0.1.48 → 0.1.49
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.
- checksums.yaml +8 -8
- data/lib/totally_lazy/functions.rb +2 -4
- data/lib/totally_lazy/sequence.rb +2 -1
- data/spec/totally_lazy/sequence_spec.rb +4 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
Yjc0NjEyODg0MmY0ODA0NDA4M2I1MWQ2MTU3YTJhMDEzZmQ2MGYxOA==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
YTYzOTAwNTc2NDI3MDg2ODhhZTIzNWJjZjhhODczZmMyZDgwM2I5OQ==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
YThjMDgwYjkzOWI0OTBjYjZlNDgzZGQ1Yjk2ZmFjMjk0MmVkMzc4NGFlN2Jj
|
10
|
+
OWU2Mzc3MjU5MGY5ODBhNzc1OTA5ZDQ4NGM2ZGFhM2E3MmZiNDA3ZWY3ZGE2
|
11
|
+
ZTliZGYwMzc5OTFmN2RkNTc0MzIyYjA4NGE0ZjRkMWExM2MzZTg=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
ZGUxZDg4Y2ZmZWQ3MjczM2RiYWUyNmNhYWQwY2MxMWZhYzQzOTk4M2NjNGIz
|
14
|
+
MzFjMTZiZDc4NWFiZmE3YzgxZTE2Nzk2OGFjNmM5ZGRlNTNjNmRmZmZhYzIy
|
15
|
+
OWI1OGU3ZmJkNGRlMmMyMTUzYjkyYjJhMTJjNjEzNmZjMDI5MDM=
|
@@ -36,7 +36,7 @@ module Functions
|
|
36
36
|
|
37
37
|
alias call_throws call_raises
|
38
38
|
|
39
|
-
def
|
39
|
+
def call_fn
|
40
40
|
->(fn) { fn.() }
|
41
41
|
end
|
42
42
|
|
@@ -70,9 +70,7 @@ module Functions
|
|
70
70
|
end
|
71
71
|
|
72
72
|
def as_promise
|
73
|
-
-> (fn) {
|
74
|
-
Concurrent::Promise.new { fn.() }
|
75
|
-
}
|
73
|
+
-> (fn) { Concurrent::Promise.new { fn.() } }
|
76
74
|
end
|
77
75
|
|
78
76
|
def execute_with(pool)
|
@@ -64,7 +64,7 @@ describe 'Sequence' do
|
|
64
64
|
end
|
65
65
|
|
66
66
|
it 'should ensure map is lazy' do
|
67
|
-
result = sequence(returns(1), call_raises(RuntimeError.new)).map(
|
67
|
+
result = sequence(returns(1), call_raises(RuntimeError.new)).map(call_fn)
|
68
68
|
expect(result.head).to eq(1)
|
69
69
|
end
|
70
70
|
|
@@ -74,7 +74,7 @@ describe 'Sequence' do
|
|
74
74
|
end
|
75
75
|
|
76
76
|
it 'should ensure filter is lazy' do
|
77
|
-
result = sequence(returns(1), returns(2), call_raises(RuntimeError.new)).map(
|
77
|
+
result = sequence(returns(1), returns(2), call_raises(RuntimeError.new)).map(call_fn).filter(even)
|
78
78
|
expect(result.head).to eq(2)
|
79
79
|
end
|
80
80
|
|
@@ -208,6 +208,7 @@ describe 'Sequence' do
|
|
208
208
|
it 'should support flatten' do
|
209
209
|
expect(sequence('Hello').map(to_characters).flatten).to eq(sequence('H', 'e', 'l', 'l', 'o'))
|
210
210
|
expect(sequence(some(1), none, some(3)).flatten).to eq(sequence(1, 3))
|
211
|
+
expect(sequence(sequence(1)).flatten).to eq(sequence(1))
|
211
212
|
end
|
212
213
|
|
213
214
|
it 'should support drop' do
|
@@ -291,6 +292,7 @@ describe 'Sequence' do
|
|
291
292
|
it 'should be able to display sequence as a string' do
|
292
293
|
expect(sequence(1,2,3,4,5).to_s).to eq('[1,2,3,4,5]')
|
293
294
|
expect(empty.to_s).to eq('[]')
|
295
|
+
expect(sequence(sequence(1)).flatten.to_s).to eq('[1]')
|
294
296
|
end
|
295
297
|
|
296
298
|
it 'should raise exception if you try to use both lambda and block' do
|