mayhaps 0.2.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +2 -2
  3. data/lib/mayhaps.rb +6 -3
  4. data/mayhaps.gemspec +1 -1
  5. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6b040f7ea36f59ace8e9eeff30c3d60dbdd10e56
4
- data.tar.gz: bd7c93a5baa9debaf9cf5408f8ba5cec9fa3502f
3
+ metadata.gz: 6ad8b77f1442c636058b5b405b85509b8d87df05
4
+ data.tar.gz: 58ce02a692b41ce39405cb5c4cf76f1ff80ef137
5
5
  SHA512:
6
- metadata.gz: 34ac68a02130ef8f656421ce90b91073131b977a90bde11b4fc505ac61bc43ace4fed87ce37df8733782dd822848130c7f40273e68bd0232526367877e9b50ae
7
- data.tar.gz: 0792ea6963a010e375802c14c66d0aaab069ad16f7acacfc6946d5bb5445a089a5ce735cade6aaaa790c52c7d49eeaee1665a367035eb0046384d63b2fa02b91
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.2.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` objects simply returns `self`.
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`,
@@ -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
- ::Kernel.raise ::ArgumentError, 'object is nil' if obj.nil?
24
- @value = obj
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 +@
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'mayhaps'
3
- s.version = '0.2.0'
3
+ s.version = '0.3.0'
4
4
  s.license = 'ISC'
5
5
  s.authors = ['Curtis McEnroe']
6
6
  s.email = ['programble@gmail.com']
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.2.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 00:00:00.000000000 Z
11
+ date: 2013-10-12 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Mayhaps (maybe) call Ruby methods
14
14
  email: