to-result 0.0.3 → 0.0.4
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +25 -0
- data/Gemfile.lock +1 -1
- data/lib/to-result.rb +4 -2
- data/tests/to_result_test.rb +8 -3
- data/to-result.gemspec +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6db91d218609e2e2694dbc1ef6754d8e7c9951d27b8bb73ad521c856db4b9c75
|
4
|
+
data.tar.gz: 90f313139ed88c00b1c1877c4d8c94d3629d2d1662fee8315a64e65894ea81d4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4113a67772569963f5b8c4f9711168903aab0a16daddf4d00a2fb1ef288651989b46b64a07e8d4b97fd8ab83e3df716c9f2cd850fb8eecb350ae30ad68359fac
|
7
|
+
data.tar.gz: 0604e31717e86753ff06df3bda5754b11916bb27b5f5b8b0b22a3d2ad73a98d3269ba4f0da3ba81c73247161815118a22e580ac6f69538555788e091052fd335
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
# Changelog
|
2
|
+
## [0.0.4](https://github.com/a-chris/to-result/tree/0.0.4) (2022-10-08)
|
3
|
+
|
4
|
+
- Adds a global `configuration` object for ToResult
|
5
|
+
- Adds `on_error` field in `configuration` to execute a block every time a error is catched
|
6
|
+
|
7
|
+
[Full Changelog](https://github.com/a-chris/to-result/compare/0.0.3...0.0.4)
|
8
|
+
|
9
|
+
## [0.0.3](https://github.com/a-chris/to-result/tree/0.0.3) (2022-10-08)
|
10
|
+
|
11
|
+
- Fixed file name, `require 'to_result'` is not needed anymore to make this gem work.
|
12
|
+
|
13
|
+
[Full Changelog](https://github.com/a-chris/to-result/compare/0.0.2...0.0.3)
|
14
|
+
|
15
|
+
## [0.0.2](https://github.com/a-chris/to-result/tree/0.0.2) (2022-09-18)
|
16
|
+
|
17
|
+
[Full Changelog](https://github.com/a-chris/to-result/compare/0.0.1...0.0.2)
|
18
|
+
|
19
|
+
## [0.0.1](https://github.com/a-chris/to-result/tree/0.0.1) (2022-09-18)
|
20
|
+
|
21
|
+
[Full Changelog](https://github.com/a-chris/to-result/compare/8dce552d6d07a2a145c45dbf7d05dbe6b0c5c578...0.0.1)
|
22
|
+
|
23
|
+
|
24
|
+
|
25
|
+
\* *This Changelog was automatically generated by [github_changelog_generator](https://github.com/github-changelog-generator/github-changelog-generator)*
|
data/Gemfile.lock
CHANGED
data/lib/to-result.rb
CHANGED
@@ -3,9 +3,11 @@ require 'dry/monads'
|
|
3
3
|
module ToResultMixin
|
4
4
|
include Dry::Monads[:do, :result, :try]
|
5
5
|
|
6
|
-
Configuration
|
6
|
+
class Configuration
|
7
|
+
attr_accessor :on_error
|
8
|
+
end
|
7
9
|
|
8
|
-
@@configuration = Configuration.new
|
10
|
+
@@configuration = Configuration.new
|
9
11
|
|
10
12
|
#
|
11
13
|
# Allow to override the @@configuration fields
|
data/tests/to_result_test.rb
CHANGED
@@ -59,10 +59,15 @@ class ToResultTest < Minitest::Test
|
|
59
59
|
def test_on_error
|
60
60
|
FakeLogger.expects(:log_error).once
|
61
61
|
|
62
|
-
|
63
|
-
|
62
|
+
# creating a clean room just for testing purpose
|
63
|
+
clean_room = Class.new(Object)
|
64
|
+
clean_room.new.instance_eval do
|
65
|
+
ToResultMixin.configure do |c|
|
66
|
+
c.on_error = Proc.new { FakeLogger.log_error }
|
67
|
+
end
|
64
68
|
end
|
65
69
|
|
66
|
-
|
70
|
+
expected = StandardError.new(@value)
|
71
|
+
assert ToResult { raise expected } == Failure(expected)
|
67
72
|
end
|
68
73
|
end
|
data/to-result.gemspec
CHANGED
@@ -5,7 +5,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = 'to-result'
|
8
|
-
s.version = '0.0.
|
8
|
+
s.version = '0.0.4'
|
9
9
|
s.summary = 'A wrapper over dry-monads to offer a handy and consistent way to implement the Railway pattern.'
|
10
10
|
s.description = 'A wrapper over dry-monads to offer a handy and consistent way to implement the Railway pattern.'
|
11
11
|
s.authors = ['Christian Toscano']
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: to-result
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Christian Toscano
|
@@ -17,6 +17,7 @@ executables: []
|
|
17
17
|
extensions: []
|
18
18
|
extra_rdoc_files: []
|
19
19
|
files:
|
20
|
+
- CHANGELOG.md
|
20
21
|
- Gemfile
|
21
22
|
- Gemfile.lock
|
22
23
|
- LICENSE
|