totally_lazy 0.1.12 → 0.1.13
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/lib/option.rb +8 -0
- data/spec/option_spec.rb +7 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
OGM1MDEzNTU2ZDQ0OGRlOTA3MDk5N2JjNGEzZjY2NDJkOTY4Y2M2MQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
OTAwNWE3ZDk1NDQwNTcyYTZmZDU2MDM2NTY3NmFhNWEyZWRhM2RmMQ==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
ZGUxODhhYTkzOGFjMTBkZTY4YTdmYTdiN2Y4MmFkNTQzZGEwMGI1YWJiNDQ3
|
10
|
+
MDQ5Yzk4OGJhYTlhODZkZTVkMTY3NTQ5N2RjMGE1NmM2OTcwMzE4YmRmMmM2
|
11
|
+
NjhjYWQ3MzEyMmRkMWQ5ZDBhMjQ5MDljOGQ0MjFjYjA5Y2FiYzY=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
YzY2YjUzMmRkMmQyNjdkY2M1ODFiYWFmMWU0Mjg5MmUxMWMxYjk1NmY3MTk5
|
14
|
+
ZDY3YjJlYmQyZTU1OWU2ZTJlYzdmY2U4ZWY1NTZhYzNhNzI3NjM3MDRiYjk2
|
15
|
+
ZTBhY2I1ODhhNDExMzY2MzA5NDZmYWY1NWUyMGNiNWYzN2JjYTI=
|
data/lib/option.rb
CHANGED
@@ -26,6 +26,10 @@ module Option
|
|
26
26
|
@value = value
|
27
27
|
end
|
28
28
|
|
29
|
+
def contains?(value)
|
30
|
+
@value == value
|
31
|
+
end
|
32
|
+
|
29
33
|
def map(fn)
|
30
34
|
some(fn.(value))
|
31
35
|
end
|
@@ -55,6 +59,10 @@ module Option
|
|
55
59
|
true
|
56
60
|
end
|
57
61
|
|
62
|
+
def contains?(_)
|
63
|
+
false
|
64
|
+
end
|
65
|
+
|
58
66
|
def map(fn)
|
59
67
|
none
|
60
68
|
end
|
data/spec/option_spec.rb
CHANGED
@@ -7,4 +7,11 @@ describe 'Option' do
|
|
7
7
|
expect(none.is_empty?).to eq(true)
|
8
8
|
expect(none.is_defined?).to eq(false)
|
9
9
|
end
|
10
|
+
|
11
|
+
it 'should support contains?' do
|
12
|
+
expect(option(1).contains?(1)).to eq(true)
|
13
|
+
expect(option(1).contains?(2)).to eq(false)
|
14
|
+
expect(none.contains?(2)).to eq(false)
|
15
|
+
end
|
16
|
+
|
10
17
|
end
|