monadic 0.7.2 → 0.7.3

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.
data/CHANGELOG.md CHANGED
@@ -1,5 +1,8 @@
1
1
  # Changelog
2
2
 
3
+ ## v0.7.3
4
+ Nothing works with `===`
5
+
3
6
  ## v0.7.2
4
7
  Add `#__fetch__` to `Maybe().proxy` to get the wrapped value.
5
8
 
@@ -82,7 +85,7 @@ Instead the new `Monad#flat_map` function operates on the underlying value as on
82
85
  `Either#else` allows to exchange the inner value of `Nothing` to an alternative value.
83
86
 
84
87
  Either(false == true).else('false was not true') == Failure(false was not true)
85
- Success('truth needs no sugar coating').else('all lies') == Success('truth needs no sugar coating')
88
+ Success('truth needs no sugar coating').or('all lies') == Success('truth needs no sugar coating')
86
89
 
87
90
  ## v0.1.1
88
91
 
data/lib/monadic/maybe.rb CHANGED
@@ -108,6 +108,10 @@ module Monadic
108
108
  def empty?
109
109
  true
110
110
  end
111
+
112
+ def ===(other)
113
+ other == Nothing
114
+ end
111
115
  end
112
116
  end
113
117
 
@@ -1,3 +1,3 @@
1
1
  module Monadic
2
- VERSION = "0.7.2"
2
+ VERSION = "0.7.3"
3
3
  end
@@ -31,9 +31,9 @@ module Transaction
31
31
  def self.fetch(params)
32
32
  return Failure('params must be a Hash') unless params.is_a? Hash
33
33
 
34
- Either(Maybe(params)['id']).else('id is missing').
35
- >= {|v| Try { BSONTestConverter.from_string(v) }.else("id '#{v}' is not a valid BSON id") }.
36
- >= {|v| Try { DatabaseReader.find(v) }.else("'#{v}' not found") }
34
+ Either(Maybe(params)['id']).or('id is missing').
35
+ >= {|v| Try { BSONTestConverter.from_string(v) }.or("id '#{v}' is not a valid BSON id") }.
36
+ >= {|v| Try { DatabaseReader.find(v) }.or("'#{v}' not found") }
37
37
  end
38
38
 
39
39
  def self.logs(request_id)
data/spec/maybe_spec.rb CHANGED
@@ -28,6 +28,10 @@ describe Monadic::Maybe do
28
28
  let(:monad) { Nothing }
29
29
  end
30
30
 
31
+ it '===' do
32
+ (Maybe(nil) === Nothing).should be_true
33
+ end
34
+
31
35
  it 'Nothing stays Nothing' do
32
36
  Maybe(nil).fetch.should == Nothing
33
37
  Maybe(nil)._.should == Nothing
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: monadic
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.2
4
+ version: 0.7.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-11-29 00:00:00.000000000 Z
12
+ date: 2012-12-01 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec