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 CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- ZWJhZWJjMGM0NzhhNTc0NTMzM2FiMDNkM2FiZTc2NzBmMTgyNzYwZg==
4
+ MmI1NGE1MzY0NmI1YjllOTVlNjUwYjczZGY5YTUyOTk0YTQ0MTk4NQ==
5
5
  data.tar.gz: !binary |-
6
- ZDIwNmViZjk5OWUxZjY1MjUxMzMzZjljNjM2ZWVhNDY5OWFjMWUyOA==
6
+ NWRjZmIyYmNkODZjMDZjOTRjZmFhMTliZDdmZjNlNjZkY2Y2MzFmMg==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- ZTI5YmRiMTc5MGIxMzUxMGRlNmY4MWJhMjA5ZTAyOGIxZmI5NGM0NjQzZDRl
10
- NGY5Y2Q3MWI5YzFkYmY2ZGFmNWJhZDhhZjVlYjRiZDU1ZTE0NDdhYWFkMWU5
11
- MjI1Zjg2MjQxMThiYTE4OTAyMWIzN2FjMzcxMWQxYTE4NmRhMTk=
9
+ MzkwYzZlYjkzNmQzY2JjMzliZjNjYmNiZTIwZjliODM0Nzc4ZDYxNmE2NGM5
10
+ OWI4Y2U2OGRhNGY3Mjg1ODc5MzZkZGY5ZDkwMWM1ZGZkYzA1YzI2MDgwZTJk
11
+ ZmJiNmM3ZjdmMDRhMGY1ODgwMDAwNWJmYjg2ZGIzM2RlYTA0Mjc=
12
12
  data.tar.gz: !binary |-
13
- MjAxMjU5OWE5ODkyZWNhMzc4MDg4MzI3ZmUzZDA2MGFmNmFkOTIyMmE4ZDIz
14
- ZWEwY2IxMWRmN2QyMTQzNDNiZDY3NjYwMTNhMDNkZjJlN2QwZTI4NzQ5ZDkz
15
- YzRjZjIwYzFkNzA0Y2QyM2QxZTFkM2QyZWNmMWFmZTNiYmQwY2M=
13
+ MTgxNzc1ODEwMjg1NGZhMTJiNTQzYjM3ODNjYjYyNWE5ZWFiMmQ5OTVmNGI3
14
+ MDExMjIwZTczZmZjMGRmZDliZjMxNjMzZTQ5YjkyZTE1ZjkwZjNjMjI1ZjE0
15
+ ZWEwYzlkYzhiOWEwZjc4NzA4N2VmNGMzMTM1MGM1MThkMWEwZjM=
@@ -21,6 +21,14 @@ module Eithers
21
21
  def right(value)
22
22
  Either.right(value)
23
23
  end
24
+
25
+ def as_left
26
+ ->(value) { left(value) }
27
+ end
28
+
29
+ def as_right
30
+ ->(value) { right(value) }
31
+ end
24
32
  end
25
33
 
26
34
  class Either
@@ -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)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: totally_lazy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.32
4
+ version: 0.1.33
5
5
  platform: ruby
6
6
  authors:
7
7
  - Raymond Barlow