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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b5c648f1df2c2c5670107f15157ff51b6a8486db
4
- data.tar.gz: 0fc967a6005772f9bec03b23475aeb219dba0e5b
3
+ metadata.gz: 4d73c6c96ece2573b67887e6feef8b384f53c01e
4
+ data.tar.gz: 63a57e8ef95127aa9aed66ca51ab65002d8db93e
5
5
  SHA512:
6
- metadata.gz: 5a4b460e8c0cef866591621608dab9fd414ad1022d692308b60fffb93034b95fe0919c87fa6329c48f56cdf2687ad6e72c6b4b5b7ae375db6f7141eb6f70acf2
7
- data.tar.gz: dc55a57e8fe119e85ba8c89356e78f0af410ccb088488bdcb95350929cf345a51b80ba089598a87e5f7890f0001904a486e0f487eda181b087b201e8d2240618
6
+ metadata.gz: 32eb3a466824cff5998acf5c6201af0e433126b26dc3aacc9befb3f0ff5ecc942db4bb4f362ad8e7a247fc626422c74fcef4f4967d4c80bc7f82c7417984bf49
7
+ data.tar.gz: 62aab7284bfa0c556c13ed066fd996cafbdd5f60321e746aae74854a9236f8f82454e8681d5700b18ee0fc2d602cb1699dc96a302dc26a817a0154e9fe075bfd
data/lib/trither.rb CHANGED
@@ -1,3 +1,3 @@
1
- require "trither/version"
2
- require "trither/try"
3
- require "trither/either"
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 then
13
+ def flat_map
14
14
  self
15
15
  end
16
16
 
17
- def on_success
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 on_failure
26
- Result.new(yield @value)
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 then
35
+ def flat_map
36
36
  yield @value
37
37
  end
38
38
 
39
- def on_success
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 on_failure
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
@@ -1,3 +1,3 @@
1
1
  module Trither
2
- VERSION = "0.1.0"
2
+ VERSION = '0.2.0'.freeze
3
3
  end
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.1.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