mayhaps 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -2
- data/lib/mayhaps.rb +6 -3
- data/mayhaps.gemspec +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6ad8b77f1442c636058b5b405b85509b8d87df05
|
4
|
+
data.tar.gz: 58ce02a692b41ce39405cb5c4cf76f1ff80ef137
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 18da27aee9e2fe2ebba2eace5157e396c3708582c1258e0d9cb7e1f036b69f4d2b5494609a2d4078a86c0813e410b9885d26118db9aff470b5a254547b8c7ef4
|
7
|
+
data.tar.gz: 1565ceb82caddce826a422076532b2ae93224142003cef06df03f04a9429534ce3e46c69f92e92df2086779efc2d009a9d5a09595723cac763869ad95c0d5454
|
data/README.md
CHANGED
@@ -10,7 +10,7 @@ nil.
|
|
10
10
|
First, install the gem or add it to your `Gemfile`:
|
11
11
|
|
12
12
|
```ruby
|
13
|
-
gem "mayhaps", "~> 0.
|
13
|
+
gem "mayhaps", "~> 0.3.0"
|
14
14
|
```
|
15
15
|
|
16
16
|
Next, require it:
|
@@ -91,7 +91,7 @@ wrapped object are:
|
|
91
91
|
`_dump` is a method added by the `Singleton` module, which `Nothing`
|
92
92
|
includes.
|
93
93
|
|
94
|
-
The `maybe` method defined on `Maybe`
|
94
|
+
The `maybe` method defined on `Maybe` allows for nested `Maybe` objects.
|
95
95
|
|
96
96
|
The `maybe` method should be used to wrap objects in `Maybe` objects,
|
97
97
|
but they can also be created directly. Since `Nothing` is a `Singleton`,
|
data/lib/mayhaps.rb
CHANGED
@@ -12,7 +12,7 @@ end
|
|
12
12
|
|
13
13
|
module Maybe
|
14
14
|
def maybe
|
15
|
-
self
|
15
|
+
::Just.new(self)
|
16
16
|
end
|
17
17
|
end
|
18
18
|
|
@@ -20,8 +20,11 @@ class Just < BasicObject
|
|
20
20
|
include ::Maybe
|
21
21
|
|
22
22
|
def initialize(obj)
|
23
|
-
|
24
|
-
|
23
|
+
if ::Maybe === obj || !obj.nil?
|
24
|
+
@value = obj
|
25
|
+
else
|
26
|
+
::Kernel.raise ::ArgumentError, 'object is nil'
|
27
|
+
end
|
25
28
|
end
|
26
29
|
|
27
30
|
def +@
|
data/mayhaps.gemspec
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mayhaps
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Curtis McEnroe
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-10-
|
11
|
+
date: 2013-10-12 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Mayhaps (maybe) call Ruby methods
|
14
14
|
email:
|