ribimaybe 0.0.9 → 0.0.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +13 -5
- data/README.md +3 -1
- data/lib/ribimaybe.rb +1 -1
- data/lib/version.rb +1 -1
- data/spec/bug_spec.rb +14 -0
- data/spec/monad_spec.rb +12 -4
- metadata +13 -11
checksums.yaml
CHANGED
@@ -1,7 +1,15 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
ZDI0OGM5YTQyNzcyMTE2N2Q1NWNhNjAxMjY3MmRmYzMyYTViNWFhYw==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
OTU3ZDdhMWJkNzliZDBjYWUyZTJiNzIzYTM2YmVmMjZhNjcyOWM3Nw==
|
5
7
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
MzQ2ODU0OWI1MzE1OTQ5MGY3OTk0NjE1MTE2ZWZjMDc5YTI1Y2ZjODIzMjdj
|
10
|
+
Njc3ODNkMGFlMDFiYzZhM2RhMWEzMGU3YjA3YWNlNDEwNjYwNDk3OTBkOGMw
|
11
|
+
M2VlOWNlZjc0OTRjNjU0YWVhZTM0OTE1YWZiMDE4YzQxNWY5NWM=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
YmNkNWVmYWExYjNiYmM1OTE5MTM3ZjVkN2VmYjE2ODAxZjMxNmM4NDA3ODI0
|
14
|
+
OTQxNjhiNGZjMDM1M2YzZWFlZWMxMWFjMWUxYTM4YWIzOTJhNmIwNTMwYmFi
|
15
|
+
NTFhNTI3ZTFlNjk4ZmNhY2FiNjQyMzEwZWEyMWU5Mzk1MmMxZjM=
|
data/README.md
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
# Ribimaybe
|
2
2
|
|
3
|
+
> "Flavouring the ocean with a teaspoon of sugar."
|
4
|
+
|
3
5
|
[![Gem Version](https://badge.fury.io/rb/ribimaybe.svg)](http://badge.fury.io/rb/ribimaybe)
|
4
6
|
[![Travis](https://travis-ci.org/unsymbol/ribimaybe.svg?branch=master)](http://travis-ci.org/unsymbol/ribimaybe)
|
5
7
|
[![Code Climate](https://codeclimate.com/github/unsymbol/ribimaybe.png)](https://codeclimate.com/github/unsymbol/ribimaybe)
|
@@ -7,7 +9,7 @@
|
|
7
9
|
![](maybe.gif)
|
8
10
|
|
9
11
|
A tiny Ruby library that provides a Maybe datatype which is a Functor,
|
10
|
-
Applicative Functor and Monad
|
12
|
+
Applicative Functor and Monad.
|
11
13
|
|
12
14
|
## Installation
|
13
15
|
|
data/lib/ribimaybe.rb
CHANGED
data/lib/version.rb
CHANGED
data/spec/bug_spec.rb
ADDED
data/spec/monad_spec.rb
CHANGED
@@ -1,6 +1,14 @@
|
|
1
1
|
require "spec_helper"
|
2
2
|
include Ribimaybe::Maybe
|
3
3
|
describe "Monad Instance" do
|
4
|
+
let(:id) do
|
5
|
+
->(x) { x }
|
6
|
+
end
|
7
|
+
|
8
|
+
let(:lifted_id) do
|
9
|
+
->(x) { id.(rturn(x)) }
|
10
|
+
end
|
11
|
+
|
4
12
|
let(:f) do
|
5
13
|
->(x){ ->(y) { rturn(x) } }.(SecureRandom.base64(1000))
|
6
14
|
end
|
@@ -13,13 +21,13 @@ describe "Monad Instance" do
|
|
13
21
|
describe "left identity" do
|
14
22
|
context "when i have nothing" do
|
15
23
|
it do
|
16
|
-
expect(Nothing.bind(&
|
24
|
+
expect(Nothing.bind(&lifted_id)).to eq(Nothing)
|
17
25
|
end
|
18
26
|
end
|
19
27
|
|
20
28
|
context "when i have just :x" do
|
21
29
|
it do
|
22
|
-
expect(rturn(:x).bind(&
|
30
|
+
expect(rturn(:x).bind(&lifted_id)).to eq(lifted_id.(:x))
|
23
31
|
end
|
24
32
|
end
|
25
33
|
end
|
@@ -28,13 +36,13 @@ describe "Monad Instance" do
|
|
28
36
|
describe "right identity" do
|
29
37
|
context "when i have nothing" do
|
30
38
|
it do
|
31
|
-
expect(Nothing.bind
|
39
|
+
expect(Nothing.bind(&lifted_id)).to eq(Nothing)
|
32
40
|
end
|
33
41
|
end
|
34
42
|
|
35
43
|
context "when i have just :x" do
|
36
44
|
it do
|
37
|
-
expect(Just(:x).bind
|
45
|
+
expect(Just(:x).bind(&lifted_id)).to eq(Just(:x))
|
38
46
|
end
|
39
47
|
end
|
40
48
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ribimaybe
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- unsymbol
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-06-
|
11
|
+
date: 2014-06-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -28,42 +28,42 @@ dependencies:
|
|
28
28
|
name: pry
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - '>='
|
31
|
+
- - ! '>='
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - '>='
|
38
|
+
- - ! '>='
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rake
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - '>='
|
45
|
+
- - ! '>='
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '0'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - '>='
|
52
|
+
- - ! '>='
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: rspec
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- - '>='
|
59
|
+
- - ! '>='
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '0'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- - '>='
|
66
|
+
- - ! '>='
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
@@ -98,6 +98,7 @@ files:
|
|
98
98
|
- maybe.gif
|
99
99
|
- ribimaybe.gemspec
|
100
100
|
- spec/applicative_functor_spec.rb
|
101
|
+
- spec/bug_spec.rb
|
101
102
|
- spec/functor_spec.rb
|
102
103
|
- spec/maybe_spec.rb
|
103
104
|
- spec/monad_spec.rb
|
@@ -112,23 +113,24 @@ require_paths:
|
|
112
113
|
- lib
|
113
114
|
required_ruby_version: !ruby/object:Gem::Requirement
|
114
115
|
requirements:
|
115
|
-
- - '>='
|
116
|
+
- - ! '>='
|
116
117
|
- !ruby/object:Gem::Version
|
117
118
|
version: 1.9.3
|
118
119
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
119
120
|
requirements:
|
120
|
-
- - '>='
|
121
|
+
- - ! '>='
|
121
122
|
- !ruby/object:Gem::Version
|
122
123
|
version: '0'
|
123
124
|
requirements: []
|
124
125
|
rubyforge_project:
|
125
|
-
rubygems_version: 2.
|
126
|
+
rubygems_version: 2.1.11
|
126
127
|
signing_key:
|
127
128
|
specification_version: 4
|
128
129
|
summary: A tiny Ruby library that provides a Maybe datatype which is a Functor, Applicative
|
129
130
|
Functor and Monad instance.
|
130
131
|
test_files:
|
131
132
|
- spec/applicative_functor_spec.rb
|
133
|
+
- spec/bug_spec.rb
|
132
134
|
- spec/functor_spec.rb
|
133
135
|
- spec/maybe_spec.rb
|
134
136
|
- spec/monad_spec.rb
|