tron 3.0.0 → 3.0.1
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/README.md +2 -2
- data/lib/tron/version.rb +1 -1
- data/lib/tron.rb +8 -0
- metadata +3 -7
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: ff3439e0b1de65431811ffcf7e212034aeacf45cb50f21547807e1cf5212ec1a
|
|
4
|
+
data.tar.gz: 5de6df38955854862853f50fa9c83b84dbca8b0d1ed2a07fda766be169b3d2e1
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: efaf109c95520de4e2274781c55387ce2712cf88dbad201e1017ab9388929b74b5b615df92d00b9356f959ccd89060e0f38b661cec8d186c2139a46ded66a0ef
|
|
7
|
+
data.tar.gz: ee66cf755026a458ecfa16bf4ba7374936627f810bf22d15eca28acbc177867469162bf0224e66a186866ccac02763b87959657d44c69a2d945e5f3a633a2878
|
data/README.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
## TL;DR
|
|
6
6
|
|
|
7
|
-
Tron is a minimalistic combination of a [monad](https://www.morozov.is/2018/09/08/monad-laws-in-ruby
|
|
7
|
+
Tron is a minimalistic combination of a [monad](https://www.morozov.is/2018/09/08/monad-laws-in-ruby/) and [value object](https://madeintandem.com/blog/creating-value-objects-in-ruby/), implemented in [a few lines](https://github.com/halo/tron/blob/master/lib/tron.rb) of code.
|
|
8
8
|
|
|
9
9
|
* Return `Tron.success(:it_worked)` or `Tron.failure(:aww_too_bad)` from a method, to explain why and how it succeded or failed. That returns an immutable Data (value object) that responds to `result.success?` and `result.failure?`.
|
|
10
10
|
* Add metadata as a second argument: `Tron.failure(:nopes, error_code: 404)` which you then can access: `result.error_code #=> 404`.
|
|
@@ -178,7 +178,7 @@ Clone the repository, run `bundle install` and run the tests with `bundle exec r
|
|
|
178
178
|
|
|
179
179
|
## Copyright
|
|
180
180
|
|
|
181
|
-
MIT halo. See [
|
|
181
|
+
MIT halo. See [LICENSE.txt](https://github.com/halo/tron/blob/master/LICENCE.txt).
|
|
182
182
|
|
|
183
183
|
## Caveats
|
|
184
184
|
|
data/lib/tron/version.rb
CHANGED
data/lib/tron.rb
CHANGED
|
@@ -35,6 +35,10 @@ module Tron
|
|
|
35
35
|
def on_failure(_ = nil)
|
|
36
36
|
self
|
|
37
37
|
end
|
|
38
|
+
|
|
39
|
+
def self.inspect
|
|
40
|
+
"#<data #{members.join(', ')}>"
|
|
41
|
+
end
|
|
38
42
|
end.new code.to_sym, *attributes.values
|
|
39
43
|
end
|
|
40
44
|
|
|
@@ -69,6 +73,10 @@ module Tron
|
|
|
69
73
|
def on_failure(proc = nil, &block)
|
|
70
74
|
(proc || block).call self
|
|
71
75
|
end
|
|
76
|
+
|
|
77
|
+
def self.inspect
|
|
78
|
+
"#<data #{members.join(', ')}>"
|
|
79
|
+
end
|
|
72
80
|
end.new code.to_sym, *attributes.values
|
|
73
81
|
end
|
|
74
82
|
end
|
metadata
CHANGED
|
@@ -1,19 +1,17 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: tron
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 3.0.
|
|
4
|
+
version: 3.0.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- halo
|
|
8
|
-
autorequire:
|
|
9
8
|
bindir: bin
|
|
10
9
|
cert_chain: []
|
|
11
|
-
date:
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
12
11
|
dependencies: []
|
|
13
12
|
description: General-purpose method return objects that can be chained. Think minimalistic
|
|
14
13
|
value object monads. Heavily inspired by the `deterministic` gem, but much much
|
|
15
14
|
more light-weight.
|
|
16
|
-
email:
|
|
17
15
|
executables: []
|
|
18
16
|
extensions: []
|
|
19
17
|
extra_rdoc_files: []
|
|
@@ -26,7 +24,6 @@ licenses:
|
|
|
26
24
|
- MIT
|
|
27
25
|
metadata:
|
|
28
26
|
rubygems_mfa_required: 'true'
|
|
29
|
-
post_install_message:
|
|
30
27
|
rdoc_options: []
|
|
31
28
|
require_paths:
|
|
32
29
|
- lib
|
|
@@ -41,8 +38,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
41
38
|
- !ruby/object:Gem::Version
|
|
42
39
|
version: '0'
|
|
43
40
|
requirements: []
|
|
44
|
-
rubygems_version:
|
|
45
|
-
signing_key:
|
|
41
|
+
rubygems_version: 4.0.1
|
|
46
42
|
specification_version: 4
|
|
47
43
|
summary: General-purpose method return objects that can be chained.
|
|
48
44
|
test_files: []
|