ribimaybe 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/lib/ribimaybe.rb +4 -22
- data/lib/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
ZjBmMGVlZWNhZmRjMjE3ZjQzODZmYzVjYTIwNTE5MzUwYTBhZjQ3ZA==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
Nzk2ZDNjMDBhZjIwYzI4ZGY2ZjNlYWM0MzZmYThlZDQ2MDYwYThjMQ==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
NTA5NmVjYzAwZDc5YjExYmNhYzU3ODIzODg2OWZjMTdhN2EyNDYxMDlmODYx
|
10
|
+
NGI1ZmFhNGYzMGJlZjc5YzZhOTUwOTIzNDNhZmJhZjcwMjNlMDc2MWQxODk5
|
11
|
+
YmIwNGQxMTZmOTY3ZmNjZGZlNWFhZmYyMTRmYjU4Y2NhYjQyMDE=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
M2I4NDU1NjRiOTQwYTUzNzFjOTNkZTRhMWVmYzViYTY3OTBjMjM0OTQxYmI0
|
14
|
+
MWE4YzA5MDNhNWM4ZmZhYjI1NmI3M2YyNzQzYzUwYmI2NWMyNzA2NzY5ZWZk
|
15
|
+
Y2UzNzNmOTg1YjU3NGYwZTQ1YmE4NDMxY2VmODczYTZlZjY3ODg=
|
data/lib/ribimaybe.rb
CHANGED
@@ -157,29 +157,11 @@ module Ribimaybe
|
|
157
157
|
#
|
158
158
|
Contract Any, Or[nil, Proc] => Or[Nothing, Just]
|
159
159
|
def Maybe(value = nil, &fn)
|
160
|
-
(value || fn) ? Just(value || fn) : Nothing
|
160
|
+
(value || fn) ? Just.new(value || fn.curry) : Nothing
|
161
161
|
end
|
162
162
|
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
#
|
167
|
-
# * +value+ - Value to be wrapped.
|
168
|
-
# * +fn+ - Block or function to be wrapped.
|
169
|
-
#
|
170
|
-
# ==== Examples
|
171
|
-
#
|
172
|
-
# Just(nil) # => Nothing
|
173
|
-
# Just(1) # => Just(1)
|
174
|
-
# Just { |x| x } # => Just(#<Proc:0x007fdecc03a478@(irb):6>)
|
175
|
-
#
|
176
|
-
Contract Any, Or[nil, Proc] => Or[Nothing, Just]
|
177
|
-
def Just(value = nil, &fn)
|
178
|
-
return Nothing unless (value || fn)
|
179
|
-
Just.new(value || fn.curry)
|
180
|
-
end
|
181
|
-
|
182
|
-
alias_method :pure, :Just
|
183
|
-
alias_method :rturn, :Just
|
163
|
+
alias_method :Just, :Maybe
|
164
|
+
alias_method :pure, :Maybe
|
165
|
+
alias_method :rturn, :Maybe
|
184
166
|
end
|
185
167
|
end
|
data/lib/version.rb
CHANGED