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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 326a7279423476cd39fd4f6179e8654f588202eb49b4845c996416cf326d3b76
4
- data.tar.gz: 5da3845b7810f1798522aa1797d522cc383443295d736fc7def2599c71bf4aef
3
+ metadata.gz: 37bc656c60ec0c017a2a9c50c7d197b2c69b9917aa653f6b310b4e3a3d962ad5
4
+ data.tar.gz: 28a3c3b2dbdb56d59b0b3c9e0e6038c5a9b4976da58605a9d70a83ef932efc1c
5
5
  SHA512:
6
- metadata.gz: e23671879a7fe1e85a818c6f665ea03db223190f07b64c74c14cfe854d284748db530c740363f2b65fc9ecf6eb3ece96f1d94d76713104dc0ae0a2c0440e7c0d
7
- data.tar.gz: 6da7bc114e8be08bf65706b5e0067680283ff1c6754e9aaec714fafd0b7ce269a651b69ba910225bf42eebb5652090e44c6be287df4712d98a057889211d08df
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.9.0...main
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
@@ -9,6 +9,10 @@ ifdef::env-github[]
9
9
  {codecov-url}[image:{codecov-img}[codecov]]
10
10
  endif::[]
11
11
 
12
+ == Is it any good?
13
+
14
+ https://news.ycombinator.com/item?id=3067434[Yes!]
15
+
12
16
  == Installation
13
17
 
14
18
  Add this line to your application's Gemfile:
@@ -6,7 +6,7 @@ module AmazingActivist
6
6
 
7
7
  # @!attribute [r] failure
8
8
  # @return failure [Symbol]
9
- prop :failure, _Interface(:to_sym), :positional, &:to_sym
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, failure, activity]
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:, activity:, exception:, context:, message: }
38
+ { failure: code, activity:, exception:, context:, message: }
40
39
  else
41
- { failure:, activity:, exception:, context: }
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(failure, **context)
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 success if success?
30
+ return value if success?
31
31
 
32
32
  yield self
33
33
  elsif default != UNDEFINED
34
- return success if success?
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 success if success?
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 :success, _Any?, :positional
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, success, activity]
21
+ [:success, value, activity]
23
22
  end
24
23
 
25
24
  # @api internal
26
25
  # @return [Hash]
27
26
  def deconstruct_keys(_)
28
- { success:, activity: }
27
+ { success: value, activity: }
29
28
  end
30
29
  end
31
30
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module AmazingActivist
4
- VERSION = "0.9.0"
4
+ VERSION = "0.10.0"
5
5
  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.9.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: 2025-05-28 00:00:00.000000000 Z
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.9.0
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.9.0/CHANGES.md
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.5
119
+ rubygems_version: 3.6.7
120
120
  specification_version: 4
121
121
  summary: Your friendly neighborhood activist.
122
122
  test_files: []