mime_actor 0.7.0 → 0.7.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c90519d1f76ba2e87980b02d88bffdf6dfe0ae9bb133df9bda76d52d2b98e2e3
4
- data.tar.gz: fb54fdf81e39bcaa79ca0099ca8b8ecbfef7411558ae3e3b0e359c902e8dce96
3
+ metadata.gz: '094172ea0e5fcae9e39f4afb809b70a3726685ea811394a9b44b131479054c31'
4
+ data.tar.gz: c1e62426da71b3864e14cbbcc5002c6d89e6b63b26c14f22bb0978ce78ce7157
5
5
  SHA512:
6
- metadata.gz: 932b2de2863e2883093320d99a1c5e9b6545c1bb8c9d8c7f18e909b5608eee0acdca9286ccc594800dde39353fa5b5d92e7f1e6a95f07bc2dcb608eb60ceb695
7
- data.tar.gz: f393a918ebac5edcae4d0de280f32e40152fedf1dcf2f717217387993f5d491bb64384333022a851dccf33b1786741bae19253cbf5d788d48bc23e189888b19d
6
+ metadata.gz: 67e13f2740eba0faba943d6ed74ba57e0b6ce27e8359fde9258ad94ba270613a871b39b628fe8ea3975f36695003272387f0243f3027242ab8b9f608bdd7005d
7
+ data.tar.gz: c14df5ab058a41f6e2f259bfb7b5ee8471d17bd88e130abc9763622eb79bcc2e326172962edaee74a29efb8920bb1d076c509df0753bc2b823eb6c3aff2bdded
data/CHANGELOG.md ADDED
@@ -0,0 +1,197 @@
1
+ # Changelog
2
+
3
+ ## [Unreleased](https://github.com/ryancyq/mime_actor/tree/HEAD)
4
+
5
+ [Full Changelog](https://github.com/ryancyq/mime_actor/compare/v0.7.0...HEAD)
6
+
7
+ **Implemented enhancements:**
8
+
9
+ - use tagged logging [\#64](https://github.com/ryancyq/mime_actor/issues/64)
10
+
11
+ **Merged pull requests:**
12
+
13
+ - feat: tagged logging [\#66](https://github.com/ryancyq/mime_actor/pull/66) ([ryancyq](https://github.com/ryancyq))
14
+ - refactor: code generator with heredoc [\#65](https://github.com/ryancyq/mime_actor/pull/65) ([ryancyq](https://github.com/ryancyq))
15
+
16
+ ## [v0.7.0](https://github.com/ryancyq/mime_actor/tree/v0.7.0) (2024-07-30)
17
+
18
+ [Full Changelog](https://github.com/ryancyq/mime_actor/compare/v0.6.4...v0.7.0)
19
+
20
+ **Merged pull requests:**
21
+
22
+ - fix: callback chain sequence respect definition ordering [\#63](https://github.com/ryancyq/mime_actor/pull/63) ([ryancyq](https://github.com/ryancyq))
23
+ - refactor: callback generator [\#62](https://github.com/ryancyq/mime_actor/pull/62) ([ryancyq](https://github.com/ryancyq))
24
+ - feat: \#act\_on\_action to replace \#respond\_act\_to [\#61](https://github.com/ryancyq/mime_actor/pull/61) ([ryancyq](https://github.com/ryancyq))
25
+ - fix: action/format validation [\#60](https://github.com/ryancyq/mime_actor/pull/60) ([ryancyq](https://github.com/ryancyq))
26
+
27
+ ## [v0.6.4](https://github.com/ryancyq/mime_actor/tree/v0.6.4) (2024-07-26)
28
+
29
+ [Full Changelog](https://github.com/ryancyq/mime_actor/compare/v0.6.3...v0.6.4)
30
+
31
+ **Implemented enhancements:**
32
+
33
+ - Use actor name generator [\#5](https://github.com/ryancyq/mime_actor/issues/5)
34
+
35
+ **Merged pull requests:**
36
+
37
+ - feat: actor delegator [\#57](https://github.com/ryancyq/mime_actor/pull/57) ([ryancyq](https://github.com/ryancyq))
38
+ - lib: add railtie for deprecation config [\#56](https://github.com/ryancyq/mime_actor/pull/56) ([ryancyq](https://github.com/ryancyq))
39
+ - lib: extract deprecation into separate file [\#55](https://github.com/ryancyq/mime_actor/pull/55) ([ryancyq](https://github.com/ryancyq))
40
+ - refactor: rename with validator into callable validator [\#54](https://github.com/ryancyq/mime_actor/pull/54) ([ryancyq](https://github.com/ryancyq))
41
+ - chore\(deps-dev\): bump rubocop from 1.64.1 to 1.65.0 [\#35](https://github.com/ryancyq/mime_actor/pull/35) ([dependabot[bot]](https://github.com/apps/dependabot))
42
+
43
+ ## [v0.6.3](https://github.com/ryancyq/mime_actor/tree/v0.6.3) (2024-07-25)
44
+
45
+ [Full Changelog](https://github.com/ryancyq/mime_actor/compare/v0.6.2...v0.6.3)
46
+
47
+ **Merged pull requests:**
48
+
49
+ - fix: validate format arg for \#cue\_actor [\#53](https://github.com/ryancyq/mime_actor/pull/53) ([ryancyq](https://github.com/ryancyq))
50
+ - fix: use controller\#action\_name [\#52](https://github.com/ryancyq/mime_actor/pull/52) ([ryancyq](https://github.com/ryancyq))
51
+ - feat: rescue act callbacks [\#51](https://github.com/ryancyq/mime_actor/pull/51) ([ryancyq](https://github.com/ryancyq))
52
+ - lib: allow actor of any visibility to be called [\#50](https://github.com/ryancyq/mime_actor/pull/50) ([ryancyq](https://github.com/ryancyq))
53
+ - feat: run act callbacks during `start_scene` [\#49](https://github.com/ryancyq/mime_actor/pull/49) ([ryancyq](https://github.com/ryancyq))
54
+ - spec: add act callbacks test sequence [\#48](https://github.com/ryancyq/mime_actor/pull/48) ([ryancyq](https://github.com/ryancyq))
55
+ - fix: support collection argument for action/format filters in act\_callacbks configuration [\#47](https://github.com/ryancyq/mime_actor/pull/47) ([ryancyq](https://github.com/ryancyq))
56
+ - refactor: move action collection vs single action rule into a composed rule in validator [\#46](https://github.com/ryancyq/mime_actor/pull/46) ([ryancyq](https://github.com/ryancyq))
57
+ - refactor: dispatcher callable API [\#45](https://github.com/ryancyq/mime_actor/pull/45) ([ryancyq](https://github.com/ryancyq))
58
+ - Revert "Revert "feat: act callbacks"" [\#44](https://github.com/ryancyq/mime_actor/pull/44) ([ryancyq](https://github.com/ryancyq))
59
+ - doc: example controller spec [\#31](https://github.com/ryancyq/mime_actor/pull/31) ([ryancyq](https://github.com/ryancyq))
60
+
61
+ ## [v0.6.2](https://github.com/ryancyq/mime_actor/tree/v0.6.2) (2024-07-21)
62
+
63
+ [Full Changelog](https://github.com/ryancyq/mime_actor/compare/v0.6.1...v0.6.2)
64
+
65
+ **Implemented enhancements:**
66
+
67
+ - feat: act callbacks [\#32](https://github.com/ryancyq/mime_actor/issues/32)
68
+
69
+ **Merged pull requests:**
70
+
71
+ - Revert "feat: act callbacks" [\#43](https://github.com/ryancyq/mime_actor/pull/43) ([ryancyq](https://github.com/ryancyq))
72
+ - feat: act callbacks [\#42](https://github.com/ryancyq/mime_actor/pull/42) ([ryancyq](https://github.com/ryancyq))
73
+ - chore: deprecate methods before removal [\#41](https://github.com/ryancyq/mime_actor/pull/41) ([ryancyq](https://github.com/ryancyq))
74
+ - lib: instance method rescue\_actor to public [\#40](https://github.com/ryancyq/mime_actor/pull/40) ([ryancyq](https://github.com/ryancyq))
75
+ - refactor: replace dispatch\_act rescue with dispatch\_actor rescue [\#39](https://github.com/ryancyq/mime_actor/pull/39) ([ryancyq](https://github.com/ryancyq))
76
+ - refactor: dispatcher call [\#38](https://github.com/ryancyq/mime_actor/pull/38) ([ryancyq](https://github.com/ryancyq))
77
+ - lib: add gem deprecation message [\#37](https://github.com/ryancyq/mime_actor/pull/37) ([ryancyq](https://github.com/ryancyq))
78
+ - lib: keep version as string [\#36](https://github.com/ryancyq/mime_actor/pull/36) ([ryancyq](https://github.com/ryancyq))
79
+ - fix: use `module_eval` inside module [\#34](https://github.com/ryancyq/mime_actor/pull/34) ([ryancyq](https://github.com/ryancyq))
80
+ - fix: use `#dispatch_act` [\#33](https://github.com/ryancyq/mime_actor/pull/33) ([ryancyq](https://github.com/ryancyq))
81
+
82
+ ## [v0.6.1](https://github.com/ryancyq/mime_actor/tree/v0.6.1) (2024-07-03)
83
+
84
+ [Full Changelog](https://github.com/ryancyq/mime_actor/compare/v0.6.0...v0.6.1)
85
+
86
+ **Implemented enhancements:**
87
+
88
+ - allow block via scene composition [\#2](https://github.com/ryancyq/mime_actor/issues/2)
89
+ - feat: actor responder [\#28](https://github.com/ryancyq/mime_actor/pull/28) ([ryancyq](https://github.com/ryancyq))
90
+ - fix: error message should use `#inspect` for param [\#27](https://github.com/ryancyq/mime_actor/pull/27) ([ryancyq](https://github.com/ryancyq))
91
+ - fix: rubocop access modifier [\#26](https://github.com/ryancyq/mime_actor/pull/26) ([ryancyq](https://github.com/ryancyq))
92
+ - refactor: rescue validation + dispatch [\#25](https://github.com/ryancyq/mime_actor/pull/25) ([ryancyq](https://github.com/ryancyq))
93
+ - fix: switch back to ClassMethods [\#24](https://github.com/ryancyq/mime_actor/pull/24) ([ryancyq](https://github.com/ryancyq))
94
+ - fix: require active support `nil` class extension [\#23](https://github.com/ryancyq/mime_actor/pull/23) ([ryancyq](https://github.com/ryancyq))
95
+ - fix: ensure validation message use \#inspect [\#22](https://github.com/ryancyq/mime_actor/pull/22) ([ryancyq](https://github.com/ryancyq))
96
+ - refactor: act\_on\_format with respond\_act\_to [\#21](https://github.com/ryancyq/mime_actor/pull/21) ([ryancyq](https://github.com/ryancyq))
97
+
98
+ **Merged pull requests:**
99
+
100
+ - fix: ensure `actor` passed to `#cue_actor` is executed within the instance [\#30](https://github.com/ryancyq/mime_actor/pull/30) ([ryancyq](https://github.com/ryancyq))
101
+ - fix: update type check logic to raise `TypeError` instead [\#29](https://github.com/ryancyq/mime_actor/pull/29) ([ryancyq](https://github.com/ryancyq))
102
+
103
+ ## [v0.6.0](https://github.com/ryancyq/mime_actor/tree/v0.6.0) (2024-07-01)
104
+
105
+ [Full Changelog](https://github.com/ryancyq/mime_actor/compare/v0.5.4...v0.6.0)
106
+
107
+ **Implemented enhancements:**
108
+
109
+ - fix: refactor rescue validations [\#20](https://github.com/ryancyq/mime_actor/pull/20) ([ryancyq](https://github.com/ryancyq))
110
+ - fix: switch over to active support class methods [\#19](https://github.com/ryancyq/mime_actor/pull/19) ([ryancyq](https://github.com/ryancyq))
111
+ - fix: use `#rescue_act_from` [\#17](https://github.com/ryancyq/mime_actor/pull/17) ([ryancyq](https://github.com/ryancyq))
112
+ - fix: promote `#act_on_format` to the public API [\#16](https://github.com/ryancyq/mime_actor/pull/16) ([ryancyq](https://github.com/ryancyq))
113
+
114
+ **Merged pull requests:**
115
+
116
+ - refactor: top level comments [\#18](https://github.com/ryancyq/mime_actor/pull/18) ([ryancyq](https://github.com/ryancyq))
117
+
118
+ ## [v0.5.4](https://github.com/ryancyq/mime_actor/tree/v0.5.4) (2024-06-29)
119
+
120
+ [Full Changelog](https://github.com/ryancyq/mime_actor/compare/v0.5.3...v0.5.4)
121
+
122
+ **Implemented enhancements:**
123
+
124
+ - fix: alias compose\_scene to act\_on\_format [\#15](https://github.com/ryancyq/mime_actor/pull/15) ([ryancyq](https://github.com/ryancyq))
125
+
126
+ ## [v0.5.3](https://github.com/ryancyq/mime_actor/tree/v0.5.3) (2024-06-29)
127
+
128
+ [Full Changelog](https://github.com/ryancyq/mime_actor/compare/v0.5.2...v0.5.3)
129
+
130
+ ## [v0.5.2](https://github.com/ryancyq/mime_actor/tree/v0.5.2) (2024-06-29)
131
+
132
+ [Full Changelog](https://github.com/ryancyq/mime_actor/compare/v0.5.1...v0.5.2)
133
+
134
+ **Implemented enhancements:**
135
+
136
+ - fix: ensure block is passed when calling dispatch\_cue [\#13](https://github.com/ryancyq/mime_actor/pull/13) ([ryancyq](https://github.com/ryancyq))
137
+
138
+ **Closed issues:**
139
+
140
+ - document API [\#4](https://github.com/ryancyq/mime_actor/issues/4)
141
+
142
+ **Merged pull requests:**
143
+
144
+ - doc: update class/methods with rdoc compatible comments [\#14](https://github.com/ryancyq/mime_actor/pull/14) ([ryancyq](https://github.com/ryancyq))
145
+ - chore\(deps-dev\): bump simplecov from 0.21.2 to 0.22.0 [\#12](https://github.com/ryancyq/mime_actor/pull/12) ([dependabot[bot]](https://github.com/apps/dependabot))
146
+
147
+ ## [v0.5.1](https://github.com/ryancyq/mime_actor/tree/v0.5.1) (2024-06-28)
148
+
149
+ [Full Changelog](https://github.com/ryancyq/mime_actor/compare/v0.4.0...v0.5.1)
150
+
151
+ **Implemented enhancements:**
152
+
153
+ - fix: refine logging message to be clearer in context [\#10](https://github.com/ryancyq/mime_actor/pull/10) ([ryancyq](https://github.com/ryancyq))
154
+ - spec: add tests for different type of error class [\#9](https://github.com/ryancyq/mime_actor/pull/9) ([ryancyq](https://github.com/ryancyq))
155
+ - spec: add tests to logging module [\#7](https://github.com/ryancyq/mime_actor/pull/7) ([ryancyq](https://github.com/ryancyq))
156
+ - spec: improve coverage [\#6](https://github.com/ryancyq/mime_actor/pull/6) ([ryancyq](https://github.com/ryancyq))
157
+
158
+ **Merged pull requests:**
159
+
160
+ - spec: add action controller specific test [\#11](https://github.com/ryancyq/mime_actor/pull/11) ([ryancyq](https://github.com/ryancyq))
161
+ - spec: add tests around rescue handler invocation context [\#8](https://github.com/ryancyq/mime_actor/pull/8) ([ryancyq](https://github.com/ryancyq))
162
+
163
+ ## [v0.4.0](https://github.com/ryancyq/mime_actor/tree/v0.4.0) (2024-06-27)
164
+
165
+ [Full Changelog](https://github.com/ryancyq/mime_actor/compare/v0.3.3...v0.4.0)
166
+
167
+ **Implemented enhancements:**
168
+
169
+ - handle Mime::ALL priority [\#3](https://github.com/ryancyq/mime_actor/issues/3)
170
+
171
+ ## [v0.3.3](https://github.com/ryancyq/mime_actor/tree/v0.3.3) (2024-06-24)
172
+
173
+ [Full Changelog](https://github.com/ryancyq/mime_actor/compare/v0.3.2...v0.3.3)
174
+
175
+ ## [v0.3.2](https://github.com/ryancyq/mime_actor/tree/v0.3.2) (2024-06-24)
176
+
177
+ [Full Changelog](https://github.com/ryancyq/mime_actor/compare/v0.3.1...v0.3.2)
178
+
179
+ ## [v0.3.1](https://github.com/ryancyq/mime_actor/tree/v0.3.1) (2024-06-23)
180
+
181
+ [Full Changelog](https://github.com/ryancyq/mime_actor/compare/v0.3.0...v0.3.1)
182
+
183
+ ## [v0.3.0](https://github.com/ryancyq/mime_actor/tree/v0.3.0) (2024-06-23)
184
+
185
+ [Full Changelog](https://github.com/ryancyq/mime_actor/compare/v0.2.1...v0.3.0)
186
+
187
+ ## [v0.2.1](https://github.com/ryancyq/mime_actor/tree/v0.2.1) (2024-06-23)
188
+
189
+ [Full Changelog](https://github.com/ryancyq/mime_actor/compare/v0.2.0...v0.2.1)
190
+
191
+ ## [v0.2.0](https://github.com/ryancyq/mime_actor/tree/v0.2.0) (2024-06-23)
192
+
193
+ [Full Changelog](https://github.com/ryancyq/mime_actor/compare/v0.1.0...v0.2.0)
194
+
195
+
196
+
197
+ \* *This Changelog was automatically generated by [github_changelog_generator](https://github.com/github-changelog-generator/github-changelog-generator)*
data/README.md CHANGED
@@ -222,7 +222,7 @@ Bug reports and pull requests are welcome on GitHub at [https://github.com/ryanc
222
222
  [rubygems_badge]: https://img.shields.io/gem/v/mime_actor.svg
223
223
  [rubygems]: https://rubygems.org/gems/mime_actor
224
224
  [ci_badge]: https://github.com/ryancyq/mime_actor/actions/workflows/build.yml/badge.svg
225
- [ci_workflows]: https://github.com/ryancyq/mime_actor/actions/workflows/
225
+ [ci_workflows]: https://github.com/ryancyq/mime_actor/actions/workflows/build.yml
226
226
  [coverage_badge]: https://codecov.io/gh/ryancyq/mime_actor/graph/badge.svg?token=4C091RHXC3
227
227
  [coverage]: https://codecov.io/gh/ryancyq/mime_actor
228
228
  [maintainability_badge]: https://api.codeclimate.com/v1/badges/06689606dc3f3945dc1b/maintainability
@@ -67,8 +67,9 @@ module MimeActor
67
67
  next
68
68
  end
69
69
 
70
- dispatch = -> { cue_actor(callable, action, format, action:, format:) }
71
- collector.public_send(format, &dispatch)
70
+ collector.public_send(format) do
71
+ fill_run_sheet(action, format) { cue_actor(callable, action, format, action:, format:) }
72
+ end
72
73
  end
73
74
  end
74
75
  end
@@ -79,7 +79,12 @@ module MimeActor
79
79
  def generate_act_callback_methods
80
80
  ActiveSupport::CodeGenerator.batch(singleton_class, __FILE__, __LINE__) do |owner|
81
81
  %i[before after around].each do |kind|
82
- generate_act_callback_kind(owner, kind)
82
+ owner.define_cached_method(:"append_act_#{kind}", namespace: :mime_callbacks) do |batch|
83
+ batch << act_callback_kind_template(kind, append: true)
84
+ end
85
+ owner.define_cached_method(:"prepend_act_#{kind}", namespace: :mime_callbacks) do |batch|
86
+ batch << act_callback_kind_template(kind, append: false)
87
+ end
83
88
  end
84
89
  end
85
90
  # as: check against the defined method in owner, code only generated after #batch block is yielded
@@ -90,27 +95,16 @@ module MimeActor
90
95
  end
91
96
  end
92
97
 
93
- def generate_act_callback_kind(generator, kind)
94
- generator.define_cached_method(:"append_act_#{kind}", namespace: :mime_callbacks) do |batch|
95
- batch.push(
96
- "def append_act_#{kind}(*callbacks, action: nil, format: nil, &block)",
97
- "validate_callback_options!(action, format)",
98
- "configure_callbacks(callbacks, action, format, block) do |callback, options|",
99
- "set_callback(:act, :#{kind}, callback, options)",
100
- "end",
101
- "end"
102
- )
103
- end
104
- generator.define_cached_method(:"prepend_act_#{kind}", namespace: :mime_callbacks) do |batch|
105
- batch.push(
106
- "def prepend_act_#{kind}(*callbacks, action: nil, format: nil, &block)",
107
- "validate_callback_options!(action, format)",
108
- "configure_callbacks(callbacks, action, format, block) do |callback, options|",
109
- "set_callback(:act, :#{kind}, callback, options.merge!(prepend: true))",
110
- "end",
111
- "end"
112
- )
113
- end
98
+ def act_callback_kind_template(kind, append:)
99
+ type = append ? "append" : "prepend"
100
+ <<-RUBY
101
+ def #{type}_act_#{kind}(*callbacks, action: nil, format: nil, &block)
102
+ validate_callback_options!(action, format)
103
+ configure_callbacks(callbacks, action, format, block) do |callback, options|
104
+ set_callback(:act, :#{kind}, callback, options.merge!(prepend: #{!append}))
105
+ end
106
+ end
107
+ RUBY
114
108
  end
115
109
  end
116
110
 
@@ -113,20 +113,27 @@ module MimeActor
113
113
  ActiveSupport::CodeGenerator.batch(generated_action_methods, __FILE__, __LINE__) do |owner|
114
114
  actions.each do |action|
115
115
  owner.define_cached_method(action, namespace: :mime_scene) do |batch|
116
- batch.push(
117
- "def #{action}",
118
- "if respond_to?(:start_scene)",
119
- "start_scene { raise #{MimeActor::ActionNotImplemented}, :#{action} unless defined?(super); super } ",
120
- "else",
121
- "raise #{MimeActor::ActionNotImplemented}, :#{action} unless defined?(super)",
122
- "super",
123
- "end",
124
- "end"
125
- )
116
+ batch << action_method_template(action)
126
117
  end
127
118
  end
128
119
  end
129
120
  end
121
+
122
+ def action_method_template(action)
123
+ <<-RUBY
124
+ def #{action}
125
+ if respond_to?(:start_scene)
126
+ start_scene do
127
+ raise #{MimeActor::ActionNotImplemented}, :#{action} unless defined?(super)
128
+ super
129
+ end
130
+ else
131
+ raise #{MimeActor::ActionNotImplemented}, :#{action} unless defined?(super)
132
+ super
133
+ end
134
+ end
135
+ RUBY
136
+ end
130
137
  end
131
138
  end
132
139
  end
@@ -14,7 +14,7 @@ module MimeActor
14
14
  module VERSION
15
15
  MAJOR = 0
16
16
  MINOR = 7
17
- BUILD = 0
17
+ BUILD = 1
18
18
  PRE = nil
19
19
 
20
20
  STRING = [MAJOR, MINOR, BUILD, PRE].compact.join(".")
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mime_actor
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.0
4
+ version: 0.7.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Chang
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-07-30 00:00:00.000000000 Z
11
+ date: 2024-07-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: actionpack
@@ -45,6 +45,7 @@ executables: []
45
45
  extensions: []
46
46
  extra_rdoc_files: []
47
47
  files:
48
+ - CHANGELOG.md
48
49
  - COMPARE.md
49
50
  - LICENSE
50
51
  - README.md