totally_lazy 0.1.32 → 0.1.33
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 +8 -0
- data/spec/totally_lazy/either_spec.rb +5 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
MmI1NGE1MzY0NmI1YjllOTVlNjUwYjczZGY5YTUyOTk0YTQ0MTk4NQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
NWRjZmIyYmNkODZjMDZjOTRjZmFhMTliZDdmZjNlNjZkY2Y2MzFmMg==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
MzkwYzZlYjkzNmQzY2JjMzliZjNjYmNiZTIwZjliODM0Nzc4ZDYxNmE2NGM5
|
10
|
+
OWI4Y2U2OGRhNGY3Mjg1ODc5MzZkZGY5ZDkwMWM1ZGZkYzA1YzI2MDgwZTJk
|
11
|
+
ZmJiNmM3ZjdmMDRhMGY1ODgwMDAwNWJmYjg2ZGIzM2RlYTA0Mjc=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
MTgxNzc1ODEwMjg1NGZhMTJiNTQzYjM3ODNjYjYyNWE5ZWFiMmQ5OTVmNGI3
|
14
|
+
MDExMjIwZTczZmZjMGRmZDliZjMxNjMzZTQ5YjkyZTE1ZjkwZjNjMjI1ZjE0
|
15
|
+
ZWEwYzlkYzhiOWEwZjc4NzA4N2VmNGMzMTM1MGM1MThkMWEwZjM=
|
data/lib/totally_lazy/either.rb
CHANGED
@@ -60,6 +60,11 @@ describe 'Either' do
|
|
60
60
|
expect(right(3).fold(2, nil, sum)).to eq(5)
|
61
61
|
end
|
62
62
|
|
63
|
+
it 'should allow map to left and right' do
|
64
|
+
expect(some('foo').map(as_left).get).to eq(left('foo'))
|
65
|
+
expect(some('bar').map(as_right).get).to eq(right('bar'))
|
66
|
+
end
|
67
|
+
|
63
68
|
it 'should raise exception if you try to use both lambda and block' do
|
64
69
|
expect { right(1).map(add(2)) { |a| a+2 } }.to raise_error(RuntimeError)
|
65
70
|
expect { right(1).map_left(add(2)) { |a| a+2 } }.to raise_error(RuntimeError)
|