amazing-activist 0.9.0 → 0.10.0
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/CHANGES.md +13 -1
- data/README.adoc +4 -0
- data/lib/amazing_activist/failure.rb +6 -7
- data/lib/amazing_activist/outcome.rb +5 -3
- data/lib/amazing_activist/success.rb +4 -5
- data/lib/amazing_activist/version.rb +1 -1
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 37bc656c60ec0c017a2a9c50c7d197b2c69b9917aa653f6b310b4e3a3d962ad5
|
4
|
+
data.tar.gz: 28a3c3b2dbdb56d59b0b3c9e0e6038c5a9b4976da58605a9d70a83ef932efc1c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 639ead2f02b487f53adc2ebb329e630a5d610e609a600a9f0382e7b2296d03d2e89cd41a61c53327fef5bb71dcf0992e1d3a6019f842f00b8d7d19f2d198f05f
|
7
|
+
data.tar.gz: 3b4d9c97d7359c587f9f03e0636b8283c6ea71be15363eae8ef71a9ff0b124205c10f767c85f9301fa5250725a747838662ff0ec40c7132b76756f38507520dc
|
data/CHANGES.md
CHANGED
@@ -8,6 +8,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
8
8
|
## [Unreleased]
|
9
9
|
|
10
10
|
|
11
|
+
## [0.10.0] - 2025-10-01
|
12
|
+
|
13
|
+
### Added
|
14
|
+
|
15
|
+
- Add `success_or` alias for `value_or`
|
16
|
+
|
17
|
+
### Removed
|
18
|
+
|
19
|
+
- (BREAKING) Remove `Failure#failure` and `Sucess#success`
|
20
|
+
|
21
|
+
|
11
22
|
## [0.9.0] - 2025-05-28
|
12
23
|
|
13
24
|
### Changed
|
@@ -120,7 +131,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
120
131
|
|
121
132
|
- Initial release.
|
122
133
|
|
123
|
-
[Unreleased]: https://github.com/ixti/amazing-activist/compare/v0.
|
134
|
+
[Unreleased]: https://github.com/ixti/amazing-activist/compare/v0.10.0...main
|
135
|
+
[0.10.0]: https://github.com/ixti/amazing-activist/compare/v0.9.0...v0.10.0
|
124
136
|
[0.9.0]: https://github.com/ixti/amazing-activist/compare/v0.8.0...v0.9.0
|
125
137
|
[0.8.0]: https://github.com/ixti/amazing-activist/compare/v0.7.0...v0.8.0
|
126
138
|
[0.7.0]: https://github.com/ixti/amazing-activist/compare/v0.6.0...v0.7.0
|
data/README.adoc
CHANGED
@@ -6,7 +6,7 @@ module AmazingActivist
|
|
6
6
|
|
7
7
|
# @!attribute [r] failure
|
8
8
|
# @return failure [Symbol]
|
9
|
-
prop :
|
9
|
+
prop :code, _Interface(:to_sym), :positional, &:to_sym
|
10
10
|
|
11
11
|
# @!attribute [r] activity
|
12
12
|
# @return [AmazingActivist::Base]
|
@@ -22,23 +22,22 @@ module AmazingActivist
|
|
22
22
|
|
23
23
|
prop :message, _String?, reader: false
|
24
24
|
|
25
|
-
def code = failure
|
26
|
-
def success? = false
|
27
25
|
def failure? = true
|
26
|
+
def success? = false
|
28
27
|
|
29
28
|
# @api internal
|
30
29
|
# @return [Array]
|
31
30
|
def deconstruct
|
32
|
-
[:failure,
|
31
|
+
[:failure, code, activity]
|
33
32
|
end
|
34
33
|
|
35
34
|
# @api internal
|
36
35
|
# @return [Hash]
|
37
36
|
def deconstruct_keys(keys)
|
38
37
|
if keys.nil? || keys.include?(:message)
|
39
|
-
{ failure
|
38
|
+
{ failure: code, activity:, exception:, context:, message: }
|
40
39
|
else
|
41
|
-
{ failure
|
40
|
+
{ failure: code, activity:, exception:, context: }
|
42
41
|
end
|
43
42
|
end
|
44
43
|
|
@@ -46,7 +45,7 @@ module AmazingActivist
|
|
46
45
|
#
|
47
46
|
# @return [String]
|
48
47
|
def message
|
49
|
-
@message || Polyglot.new(activity).message(
|
48
|
+
@message || Polyglot.new(activity).message(code, **context)
|
50
49
|
end
|
51
50
|
end
|
52
51
|
end
|
@@ -27,11 +27,11 @@ module AmazingActivist
|
|
27
27
|
if block_given?
|
28
28
|
warn "block supersedes default value argument" unless default == UNDEFINED
|
29
29
|
|
30
|
-
return
|
30
|
+
return value if success?
|
31
31
|
|
32
32
|
yield self
|
33
33
|
elsif default != UNDEFINED
|
34
|
-
return
|
34
|
+
return value if success?
|
35
35
|
|
36
36
|
default
|
37
37
|
else
|
@@ -39,10 +39,12 @@ module AmazingActivist
|
|
39
39
|
end
|
40
40
|
end
|
41
41
|
|
42
|
+
alias success_or value_or
|
43
|
+
|
42
44
|
# @return [Object] {#success} if outcome is {Success}
|
43
45
|
# @raise [UnwrapError] otherwise
|
44
46
|
def unwrap!
|
45
|
-
return
|
47
|
+
return value if success?
|
46
48
|
|
47
49
|
raise UnwrapError, self
|
48
50
|
end
|
@@ -6,26 +6,25 @@ module AmazingActivist
|
|
6
6
|
|
7
7
|
# @!attribute [r] success
|
8
8
|
# @return [AmazingActivist::Base]
|
9
|
-
prop :
|
9
|
+
prop :value, _Any?, :positional
|
10
10
|
|
11
11
|
# @!attribute [r] activity
|
12
12
|
# @return [AmazingActivist::Base]
|
13
13
|
prop :activity, AmazingActivist::Base
|
14
14
|
|
15
|
-
def value = success
|
16
|
-
def success? = true
|
17
15
|
def failure? = false
|
16
|
+
def success? = true
|
18
17
|
|
19
18
|
# @api internal
|
20
19
|
# @return [Array]
|
21
20
|
def deconstruct
|
22
|
-
[:success,
|
21
|
+
[:success, value, activity]
|
23
22
|
end
|
24
23
|
|
25
24
|
# @api internal
|
26
25
|
# @return [Hash]
|
27
26
|
def deconstruct_keys(_)
|
28
|
-
{ success
|
27
|
+
{ success: value, activity: }
|
29
28
|
end
|
30
29
|
end
|
31
30
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: amazing-activist
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.10.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alexey Zapparov
|
8
8
|
bindir: exe
|
9
9
|
cert_chain: []
|
10
|
-
date:
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
11
11
|
dependencies:
|
12
12
|
- !ruby/object:Gem::Dependency
|
13
13
|
name: activesupport
|
@@ -98,9 +98,9 @@ licenses:
|
|
98
98
|
- MIT
|
99
99
|
metadata:
|
100
100
|
homepage_uri: https://github.com/ixti/amazing-activist
|
101
|
-
source_code_uri: https://github.com/ixti/amazing-activist/tree/v0.
|
101
|
+
source_code_uri: https://github.com/ixti/amazing-activist/tree/v0.10.0
|
102
102
|
bug_tracker_uri: https://github.com/ixti/amazing-activist/issues
|
103
|
-
changelog_uri: https://github.com/ixti/amazing-activist/blob/v0.
|
103
|
+
changelog_uri: https://github.com/ixti/amazing-activist/blob/v0.10.0/CHANGES.md
|
104
104
|
rubygems_mfa_required: 'true'
|
105
105
|
rdoc_options: []
|
106
106
|
require_paths:
|
@@ -116,7 +116,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
116
116
|
- !ruby/object:Gem::Version
|
117
117
|
version: '0'
|
118
118
|
requirements: []
|
119
|
-
rubygems_version: 3.6.
|
119
|
+
rubygems_version: 3.6.7
|
120
120
|
specification_version: 4
|
121
121
|
summary: Your friendly neighborhood activist.
|
122
122
|
test_files: []
|