mprelude 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/mprelude.rb +14 -0
- data/mprelude.gemspec +1 -1
- data/spec/unit/mprelude/either_spec.rb +40 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a2f63ad7edffa0ca7d09d0f162bdf253e34cccf1f182f23360e5e0ee45b76bf8
|
4
|
+
data.tar.gz: 680b19d4359642670d74876d44715cfa26f9156317df4275caf761c31501ee68
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 381d73dae951033421d881ef7114c06c6d33bdbc927c8aa9841eaf18c24061e8eff7528f28e088d904d903764cf6946d4a5fd853bdb82cb122fbd6b61afd47dd
|
7
|
+
data.tar.gz: 01a108b78ad032393c9e76ef0f2d988bb47480d1ed7428d138591549fa9e2d450be22c8e3505ac257f0a6ef6eca7870f8c9d17bb8e16098ec8891a1fb107f956
|
data/Gemfile.lock
CHANGED
data/lib/mprelude.rb
CHANGED
@@ -89,6 +89,20 @@ module MPrelude
|
|
89
89
|
Left.new(error)
|
90
90
|
end
|
91
91
|
|
92
|
+
# Test for left constructor
|
93
|
+
#
|
94
|
+
# @return [Boolean]
|
95
|
+
def left?
|
96
|
+
instance_of?(Left)
|
97
|
+
end
|
98
|
+
|
99
|
+
# Test for right constructor
|
100
|
+
#
|
101
|
+
# @return [Boolean]
|
102
|
+
def right?
|
103
|
+
instance_of?(Right)
|
104
|
+
end
|
105
|
+
|
92
106
|
class Left < self
|
93
107
|
# Evaluate functor block
|
94
108
|
#
|
data/mprelude.gemspec
CHANGED
@@ -188,6 +188,26 @@ RSpec.describe MPrelude::Either::Left do
|
|
188
188
|
|
189
189
|
include_examples '#apply block evaluation'
|
190
190
|
end
|
191
|
+
|
192
|
+
describe '#left?' do
|
193
|
+
def apply
|
194
|
+
subject.left?
|
195
|
+
end
|
196
|
+
|
197
|
+
it 'returns true' do
|
198
|
+
expect(apply).to be(true)
|
199
|
+
end
|
200
|
+
end
|
201
|
+
|
202
|
+
describe '#right?' do
|
203
|
+
def apply
|
204
|
+
subject.right?
|
205
|
+
end
|
206
|
+
|
207
|
+
it 'returns false' do
|
208
|
+
expect(apply).to be(false)
|
209
|
+
end
|
210
|
+
end
|
191
211
|
end
|
192
212
|
|
193
213
|
RSpec.describe MPrelude::Either::Right do
|
@@ -291,4 +311,24 @@ RSpec.describe MPrelude::Either::Right do
|
|
291
311
|
|
292
312
|
include_examples '#apply block evaluation'
|
293
313
|
end
|
314
|
+
|
315
|
+
describe '#left?' do
|
316
|
+
def apply
|
317
|
+
subject.left?
|
318
|
+
end
|
319
|
+
|
320
|
+
it 'returns false' do
|
321
|
+
expect(apply).to be(false)
|
322
|
+
end
|
323
|
+
end
|
324
|
+
|
325
|
+
describe '#right?' do
|
326
|
+
def apply
|
327
|
+
subject.right?
|
328
|
+
end
|
329
|
+
|
330
|
+
it 'returns true' do
|
331
|
+
expect(apply).to be(true)
|
332
|
+
end
|
333
|
+
end
|
294
334
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mprelude
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Markus Schirp
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-09-
|
11
|
+
date: 2019-09-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: abstract_type
|