trither 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/trither.rb +3 -3
- data/lib/trither/try.rb +7 -13
- data/lib/trither/version.rb +1 -1
- metadata +15 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4d73c6c96ece2573b67887e6feef8b384f53c01e
|
4
|
+
data.tar.gz: 63a57e8ef95127aa9aed66ca51ab65002d8db93e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 32eb3a466824cff5998acf5c6201af0e433126b26dc3aacc9befb3f0ff5ecc942db4bb4f362ad8e7a247fc626422c74fcef4f4967d4c80bc7f82c7417984bf49
|
7
|
+
data.tar.gz: 62aab7284bfa0c556c13ed066fd996cafbdd5f60321e746aae74854a9236f8f82454e8681d5700b18ee0fc2d602cb1699dc96a302dc26a817a0154e9fe075bfd
|
data/lib/trither.rb
CHANGED
@@ -1,3 +1,3 @@
|
|
1
|
-
require
|
2
|
-
require
|
3
|
-
require
|
1
|
+
require 'trither/version'
|
2
|
+
require 'trither/try'
|
3
|
+
require 'trither/either'
|
data/lib/trither/try.rb
CHANGED
@@ -10,11 +10,11 @@ module Try
|
|
10
10
|
true
|
11
11
|
end
|
12
12
|
|
13
|
-
def
|
13
|
+
def flat_map
|
14
14
|
self
|
15
15
|
end
|
16
16
|
|
17
|
-
def
|
17
|
+
def map
|
18
18
|
self
|
19
19
|
end
|
20
20
|
|
@@ -22,8 +22,8 @@ module Try
|
|
22
22
|
Failure.new(yield @value)
|
23
23
|
end
|
24
24
|
|
25
|
-
def
|
26
|
-
|
25
|
+
def get_or_else
|
26
|
+
yield @value
|
27
27
|
end
|
28
28
|
end
|
29
29
|
|
@@ -32,11 +32,11 @@ module Try
|
|
32
32
|
false
|
33
33
|
end
|
34
34
|
|
35
|
-
def
|
35
|
+
def flat_map
|
36
36
|
yield @value
|
37
37
|
end
|
38
38
|
|
39
|
-
def
|
39
|
+
def map
|
40
40
|
Success.new(yield @value)
|
41
41
|
end
|
42
42
|
|
@@ -44,13 +44,7 @@ module Try
|
|
44
44
|
self
|
45
45
|
end
|
46
46
|
|
47
|
-
def
|
48
|
-
Result.new @value
|
49
|
-
end
|
50
|
-
end
|
51
|
-
|
52
|
-
class Result < Base
|
53
|
-
def unwrap
|
47
|
+
def get_or_else
|
54
48
|
@value
|
55
49
|
end
|
56
50
|
end
|
data/lib/trither/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: trither
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lyall Jonathan Di Trapani
|
@@ -52,6 +52,20 @@ dependencies:
|
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '3.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rubocop
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
55
69
|
description: Very simple implementations of Try and Either inspired by Scala
|
56
70
|
email:
|
57
71
|
- lj.ditrapani@gmail.com
|