to-result 0.0.3 → 0.0.4

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
  SHA256:
3
- metadata.gz: 842070fb5be7a4388055318b3956091d4869885c76d745c0dd01ba87cde415e5
4
- data.tar.gz: 0a7c4e93685409f3f96479df8482255e501a88db53523c55d2f5f171255f58a3
3
+ metadata.gz: 6db91d218609e2e2694dbc1ef6754d8e7c9951d27b8bb73ad521c856db4b9c75
4
+ data.tar.gz: 90f313139ed88c00b1c1877c4d8c94d3629d2d1662fee8315a64e65894ea81d4
5
5
  SHA512:
6
- metadata.gz: c16327c7a1420c8c1b711d98ffd59de246a3221c98dd6a3bae2cf3650c731c558ccbb02effccdd25d6f9f99e0097d030d751cf8c1dac40569b97dd95b4845817
7
- data.tar.gz: 23d78aac99bc431eb9b47aafe9aca8dde5b95615766a60305ce016638a3c26e74ac632f5c19bf9c913a5ce70a2ba14d187dc3aea99f8c5876155db4ad9cbed34
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
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- to-result (0.0.3)
4
+ to-result (0.0.4)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
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 = Struct.new(:on_error)
6
+ class Configuration
7
+ attr_accessor :on_error
8
+ end
7
9
 
8
- @@configuration = Configuration.new(on_error: nil)
10
+ @@configuration = Configuration.new
9
11
 
10
12
  #
11
13
  # Allow to override the @@configuration fields
@@ -59,10 +59,15 @@ class ToResultTest < Minitest::Test
59
59
  def test_on_error
60
60
  FakeLogger.expects(:log_error).once
61
61
 
62
- ToResultMixin.configure do |c|
63
- c.on_error = Proc.new { FakeLogger.log_error }
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
- ToResult { raise StandardError.new(@value) }
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.3'
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.3
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