totally_lazy 0.1.29 → 0.1.30
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/either.rb +4 -0
- data/spec/totally_lazy/either_spec.rb +5 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
ZTQ2YmVkZDgxNGZlNzM3M2JkMzZmMmEyM2NhNTgwZGRlMGExMDE2Mw==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
NjMzYTViMTYzMzNmNGRkMTg1ZGQyM2E5ODc2M2E3Zjg3ZmZkZWJmMA==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
MmY4Njg5Mzc0NThhMjI1OWNmMmU4ODY3YmU2ODY1MTlmZjlhMWNkZDcyOWMw
|
10
|
+
ZjQ4NDNlYjY1NWM2ZTQyNGJhMjYxMzA5NDMzMjQzODI0ZDlmZTZlYTk4NTBm
|
11
|
+
ZGVhYmQ5YzdjMTg3NDgyZWI3NzkyMmZiNWFjYTgyOWUwM2VjMTU=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
NTI4YmJlNmIwMGE3YTZkZGIxODEzZjE4MmYwMDk2NmViYzJmOTVmNzRkYTVj
|
14
|
+
YmNmZTcwNDhmYTAwZGI0NjU1ZTJlNzRmYWQ5YTAzMThjNjk2NDU4NWViMmVk
|
15
|
+
MjJmZDIzYTMyMWFhYmZmZDNhZDcyZDQxMjBjYTZjM2U3NTVlNWM=
|
data/lib/totally_lazy/either.rb
CHANGED
@@ -35,6 +35,11 @@ describe 'Either' do
|
|
35
35
|
expect(left(2).flat_map { right(5) }).to eq(left(2))
|
36
36
|
end
|
37
37
|
|
38
|
+
it 'should support flatten' do
|
39
|
+
expect(right(left(ZeroDivisionError.new)).flatten).to eq(left(ZeroDivisionError.new))
|
40
|
+
expect(right(right(1)).flatten).to eq(right(1))
|
41
|
+
end
|
42
|
+
|
38
43
|
it 'should raise exception if you try to use both lambda and block' do
|
39
44
|
expect { right(1).map(add(2)) { |a| a+2 } }.to raise_error(RuntimeError)
|
40
45
|
expect { right(1).map_left(add(2)) { |a| a+2 } }.to raise_error(RuntimeError)
|
@@ -42,5 +47,4 @@ describe 'Either' do
|
|
42
47
|
expect { right(10).flat_map(divide(2)) { |a| a/2 } }.to raise_error(RuntimeError)
|
43
48
|
expect { left(10).flat_map(divide(2)) { |a| a/2 } }.to raise_error(RuntimeError)
|
44
49
|
end
|
45
|
-
|
46
50
|
end
|