amazing-activist 0.6.0 → 0.8.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: bc682de44572c16ca1a0d4b1ad94e771c94a18f29ff7aafc53c2c6a44f5f9bdf
4
- data.tar.gz: 9e5419f79392609bebf059df7380139262927b94e32b49df4c0770cadf437358
3
+ metadata.gz: c059cc4ff198a6fb4d721683061c51063050fa209f4bdb3d0e27b0232abd2e7f
4
+ data.tar.gz: 1cfd1f85b06587f6c3ab903e36ae15fdd25c5f7c9f366690e041a89a71fcb952
5
5
  SHA512:
6
- metadata.gz: 93ace31de12aecf905e25390b51e4672c46a3cd5dfb8bf5bf38f70c04bfd0dd16e03bdb0fb192fc52f889b679810e9b2312a5b8a859148b809d54aca9954c218
7
- data.tar.gz: 4681c868840de2df1030f11da788247763f5fd92ea69da706d62b3bcb7b2e1f0e6d455eaf288d3b16a26c9b9d6941b9a0cc538cc2c8e814a8ca805d48582d956
6
+ metadata.gz: 1f21b35f615f84a428d6b53c859b4bcf0c1a60bbb5f41c3bea265135c1acd32e7cf99d734b05bdae3913199095517d632ee042da175581c9ac7fc335b30a97ae
7
+ data.tar.gz: f8123ee0debd3ae42218f1651b8b9df163aef428f778b26f1e12296861b354c7710eb8f5e97ab042746a6e881cb467e36b2dc676b230731e9fdf4621affe73a2
data/CHANGES.md CHANGED
@@ -8,6 +8,30 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
8
8
  ## [Unreleased]
9
9
 
10
10
 
11
+ ## [0.8.0] - 2025-05-01
12
+
13
+ ### Changed
14
+
15
+ - (BREAKING) Prohibit `AmazingActivist::Base#new` calls. All activities must be
16
+ called via `.call`, i.e. `A.call(...)` instead of `A.new(...).call`.
17
+
18
+ ### Removed
19
+
20
+ - (BREAKING) Don't provide default catch-all `params` prop.
21
+
22
+
23
+ ## [0.7.0] - 2025-04-14
24
+
25
+ ### Added
26
+
27
+ - Use [literal](https://github.com/joeldrapper/literal) gem to aid inputs
28
+ boilerplate.
29
+
30
+ ### Changed
31
+
32
+ - (BREAKING) Drop support of Ruby-3.0.X, and Ruby-3.1.X
33
+
34
+
11
35
  ## [0.6.0] - 2024-12-15
12
36
 
13
37
  ### Added
@@ -85,7 +109,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
85
109
 
86
110
  - Initial release.
87
111
 
88
- [Unreleased]: https://github.com/ixti/amazing-activist/compare/v0.6.0...main
112
+ [Unreleased]: https://github.com/ixti/amazing-activist/compare/v0.8.0...main
113
+ [0.8.0]: https://github.com/ixti/amazing-activist/compare/v0.7.0...v0.8.0
114
+ [0.7.0]: https://github.com/ixti/amazing-activist/compare/v0.6.0...v0.7.0
89
115
  [0.6.0]: https://github.com/ixti/amazing-activist/compare/v0.5.2...v0.6.0
90
116
  [0.5.2]: https://github.com/ixti/amazing-activist/compare/v0.5.1...v0.5.2
91
117
  [0.5.1]: https://github.com/ixti/amazing-activist/compare/v0.5.0...v0.5.1
data/README.adoc CHANGED
@@ -58,8 +58,6 @@ end
58
58
  This library aims to support and is tested against:
59
59
 
60
60
  * https://www.ruby-lang.org[Ruby]
61
- ** MRI 3.0.x
62
- ** MRI 3.1.x
63
61
  ** MRI 3.2.x
64
62
  ** MRI 3.3.x
65
63
  ** MRI 3.4.x
@@ -11,6 +11,8 @@ module AmazingActivist
11
11
  # [source,ruby]
12
12
  # ----
13
13
  # class OnboardActivity < AmazingActivist::Base
14
+ # prop :params, _Hash(Symbol, _Any?), :**
15
+ #
14
16
  # def call
15
17
  # user = User.new(params)
16
18
  #
@@ -31,9 +33,9 @@ module AmazingActivist
31
33
  class Base
32
34
  extend Irresistible
33
35
 
34
- # @param params [Hash{Symbol => Object}]
35
- def initialize(**params)
36
- @params = params
36
+ class << self
37
+ # Prohibit `Activity.new(...).call` style, as it makes activist not much `Irresistable`
38
+ private :new
37
39
  end
38
40
 
39
41
  # @return [Outcome::Success, Outcome::Failure]
@@ -43,9 +45,6 @@ module AmazingActivist
43
45
 
44
46
  private
45
47
 
46
- # @return [Hash{Symbol => Object}]
47
- attr_reader :params
48
-
49
48
  # @param value (see Outcome::Success#initialize)
50
49
  # @return [Outcome::Success]
51
50
  def success(value = nil)
@@ -1,9 +1,13 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require "literal"
4
+
3
5
  require_relative "./broken_contract_error"
4
6
 
5
7
  module AmazingActivist
6
8
  module Contractable
9
+ include Literal::Properties
10
+
7
11
  DEFAULT_BROKEN_OUTCOME_HANDLER = lambda do |outcome|
8
12
  raise BrokenContractError, "#{self.class}#call returned #{outcome.class} instead of Outcome"
9
13
  end
@@ -26,6 +30,10 @@ module AmazingActivist
26
30
 
27
31
  private
28
32
 
33
+ def prop(name, type, kind = :keyword, reader: :private, default: nil, &)
34
+ super(name, type, kind, reader:, writer: false, predicate: false, default:, &)
35
+ end
36
+
29
37
  def on_broken_outcome(&block)
30
38
  raise ArgumentError, "Handler block required." unless block
31
39
 
@@ -12,7 +12,6 @@ module AmazingActivist
12
12
 
13
13
  # Initialize and call activity.
14
14
  #
15
- # @see #initialize
16
15
  # @see #call
17
16
  def call(...)
18
17
  activity = new(...)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module AmazingActivist
4
- VERSION = "0.6.0"
4
+ VERSION = "0.8.0"
5
5
  end
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: amazing-activist
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.8.0
5
5
  platform: ruby
6
- original_platform: ''
7
6
  authors:
8
7
  - Alexey Zapparov
9
8
  bindir: exe
10
9
  cert_chain: []
11
- date: 2024-12-16 00:00:00.000000000 Z
10
+ date: 2025-05-01 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: activesupport
@@ -38,6 +37,20 @@ dependencies:
38
37
  - - ">="
39
38
  - !ruby/object:Gem::Version
40
39
  version: '0'
40
+ - !ruby/object:Gem::Dependency
41
+ name: literal
42
+ requirement: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - ">="
45
+ - !ruby/object:Gem::Version
46
+ version: '0'
47
+ type: :runtime
48
+ prerelease: false
49
+ version_requirements: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - ">="
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
41
54
  description: Another take on Command Pattern.
42
55
  email:
43
56
  - alexey@zapparov.com
@@ -70,9 +83,9 @@ licenses:
70
83
  - MIT
71
84
  metadata:
72
85
  homepage_uri: https://github.com/ixti/amazing-activist
73
- source_code_uri: https://github.com/ixti/amazing-activist/tree/v0.6.0
86
+ source_code_uri: https://github.com/ixti/amazing-activist/tree/v0.8.0
74
87
  bug_tracker_uri: https://github.com/ixti/amazing-activist/issues
75
- changelog_uri: https://github.com/ixti/amazing-activist/blob/v0.6.0/CHANGES.md
88
+ changelog_uri: https://github.com/ixti/amazing-activist/blob/v0.8.0/CHANGES.md
76
89
  rubygems_mfa_required: 'true'
77
90
  rdoc_options: []
78
91
  require_paths:
@@ -81,14 +94,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
81
94
  requirements:
82
95
  - - ">="
83
96
  - !ruby/object:Gem::Version
84
- version: 3.0.0
97
+ version: 3.2.0
85
98
  required_rubygems_version: !ruby/object:Gem::Requirement
86
99
  requirements:
87
100
  - - ">="
88
101
  - !ruby/object:Gem::Version
89
102
  version: '0'
90
103
  requirements: []
91
- rubygems_version: 3.6.0.dev
104
+ rubygems_version: 3.6.5
92
105
  specification_version: 4
93
106
  summary: Your friendly neighborhood activist.
94
107
  test_files: []