mime_actor 0.7.0 → 0.7.2

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: 0a87bfedb97fbef298d6111d7696369ace182dcbd578c5ee21a80954c4836053
4
+ data.tar.gz: c66f2b2178559fe63c2c62c49ab9586ef2202317c6e60a9697b769c86debe726
5
5
  SHA512:
6
- metadata.gz: 932b2de2863e2883093320d99a1c5e9b6545c1bb8c9d8c7f18e909b5608eee0acdca9286ccc594800dde39353fa5b5d92e7f1e6a95f07bc2dcb608eb60ceb695
7
- data.tar.gz: f393a918ebac5edcae4d0de280f32e40152fedf1dcf2f717217387993f5d491bb64384333022a851dccf33b1786741bae19253cbf5d788d48bc23e189888b19d
6
+ metadata.gz: e1d916d1c16d64d2d47f2e61b98ce00064c5987f6c923e82ff679eadc1d22553a5b29e965e2ce6183762d4a430ee4495b76e522ddc0c735de5d64d0d6c723e6a
7
+ data.tar.gz: 3506c2349080d7bc149f3490b33690ca2686ae0d37b3bde00c391a143d05ffdac3007b6575703a4e8c04935430dedfffc42704849cde4b8091c91cce11034e8c
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,38 +79,26 @@ 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)
83
- end
84
- end
85
- # as: check against the defined method in owner, code only generated after #batch block is yielded
86
- ActiveSupport::CodeGenerator.batch(singleton_class, __FILE__, __LINE__) do |owner|
87
- %i[before after around].each do |kind|
88
- owner.define_cached_method(:"act_#{kind}", as: :"append_act_#{kind}", namespace: :mime_callbacks)
82
+ owner.define_cached_method(:"append_act_#{kind}", as: :"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
89
88
  end
90
89
  end
91
90
  end
92
91
 
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
92
+ def act_callback_kind_template(kind, append:)
93
+ type = append ? "append" : "prepend"
94
+ <<-RUBY
95
+ def #{type}_act_#{kind}(*callbacks, action: nil, format: nil, &block)
96
+ validate_callback_options!(action, format)
97
+ configure_callbacks(callbacks, action, format, block) do |callback, options|
98
+ set_callback(:act, :#{kind}, callback, options.merge!(prepend: #{!append}))
99
+ end
100
+ end
101
+ RUBY
114
102
  end
115
103
  end
116
104
 
@@ -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 = 2
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.2
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-08-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: actionpack