just_maybe 1.0.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d2d252ffb42e2b682f5a18422cabec3209753c1a
4
- data.tar.gz: ab0e342a64665b8964da74aa3dd8fec43dd2507e
3
+ metadata.gz: 72ef2ce85b41d39244227cb4c844a34a32e4eb12
4
+ data.tar.gz: 9e82969ab7e6fd4f117f686cf9605d0eb745282b
5
5
  SHA512:
6
- metadata.gz: 715a90005076e8bfb1d5f886041bb67763da284ea2a882f6d26bceee852ce9d7cbe9e9ddbd65452cc9b9f9b4ced31627e20d036be0cb41ba9f2c1b92aaeb54cf
7
- data.tar.gz: a024ad10967d3734eb8029e68d0d216b0c18c2606d7b48b3b6f6d0b5f0c1e50282b53168ecba1f101dd0f91ea1b92723deb8288622db9dae76d79c509fe223c3
6
+ metadata.gz: 369988e0deb62bad303c334d60ffa9624882498d23dabfd91b351ab511097a1338f64c1dac8418b05546385fd795daf6c62e8194f713ab5242a00026bc06a40e
7
+ data.tar.gz: df965b85481a20aa6a68c3e1b7a529e7ec7b9b1aefc45549bd2f565b07ef2ed925d9f507e041759df1d1c19889d410de70f611a1ec299ac3323bd8c3d8a1f081
data/README.md CHANGED
@@ -1,8 +1,8 @@
1
- # JustMaybe
1
+ # Just Maybe
2
2
 
3
3
  An implementation of the "Maybe" pattern.
4
4
 
5
- The philosophy of this particular implementation of the Maybe pattern is that you should use the `Maybe` function to wrap values before returning them from any method that could potentially return nil. This forces the consumer of the returned object to pro-actively acknowledge that it could be nil by forcing them to use the `try` method to access it.
5
+ The philosophy of this particular implementation of the Maybe pattern is that you should use the `Maybe` function to wrap values before returning them from any method that could potentially return `nil`. This forces the consumer of the returned object to pro-actively acknowledge that it could be `nil` by forcing them to use the `try` method to access it.
6
6
 
7
7
  This implementation also does no monkey patching and does not rely on method missing or any other Ruby magic for it's implementation.
8
8
 
@@ -19,7 +19,3 @@ class Just
19
19
  "Just: #{@object}"
20
20
  end
21
21
  end
22
-
23
- def Just(object)
24
- Just.new(object)
25
- end
@@ -3,9 +3,6 @@ require 'singleton'
3
3
  class Nothing
4
4
  include Singleton
5
5
 
6
- def initialize
7
- end
8
-
9
6
  def nothing?
10
7
  true
11
8
  end
@@ -21,7 +18,3 @@ class Nothing
21
18
  "Nothing"
22
19
  end
23
20
  end
24
-
25
- #def Nothing
26
- # NothingSingleton.instance
27
- #end
@@ -1,3 +1,3 @@
1
1
  module JustMaybe
2
- VERSION = "1.0.0"
2
+ VERSION = "1.0.1"
3
3
  end
data/lib/just_maybe.rb CHANGED
@@ -6,6 +6,6 @@ def Maybe(object)
6
6
  if object.nil?
7
7
  Nothing.instance
8
8
  else
9
- Just(object)
9
+ Just.new(object)
10
10
  end
11
11
  end
data/spec/just_spec.rb CHANGED
@@ -3,20 +3,19 @@ require 'just_maybe/just'
3
3
  describe Just do
4
4
 
5
5
  it "just 'anything' is something" do
6
- expect(Just('anything')).to be_something
6
+ expect(Just.new('anything')).to be_something
7
7
  end
8
8
 
9
9
  it "just 'anything' is not nothing" do
10
- expect(Just('anything')).not_to be_nothing
11
- expect(Just(nil)).not_to be_nothing
10
+ expect(Just.new('anything')).not_to be_nothing
12
11
  end
13
12
 
14
13
  it "just nil is something and not nothing" do
15
- expect(Just(nil)).to be_something
16
- expect(Just(nil)).not_to be_nothing
14
+ expect(Just.new(nil)).to be_something
15
+ expect(Just.new(nil)).not_to be_nothing
17
16
  end
18
17
 
19
18
  it "just 'anything' yields once with 'anything' to try" do
20
- expect(Just('anything').try{|o| o.reverse }).to eq('gnihtyna')
19
+ expect(Just.new('anything').try{|o| o.reverse }).to eq('gnihtyna')
21
20
  end
22
21
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: just_maybe
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Greenly
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-08-03 00:00:00.000000000 Z
11
+ date: 2014-08-04 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: A simple implmenetation of the Maybe pattern
14
14
  email: