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 +4 -4
- data/README.md +1 -1
- data/lib/mime_actor/action.rb +3 -2
- data/lib/mime_actor/callbacks.rb +16 -28
- data/lib/mime_actor/scene.rb +17 -10
- data/lib/mime_actor/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0a87bfedb97fbef298d6111d7696369ace182dcbd578c5ee21a80954c4836053
|
4
|
+
data.tar.gz: c66f2b2178559fe63c2c62c49ab9586ef2202317c6e60a9697b769c86debe726
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
data/lib/mime_actor/action.rb
CHANGED
@@ -67,8 +67,9 @@ module MimeActor
|
|
67
67
|
next
|
68
68
|
end
|
69
69
|
|
70
|
-
|
71
|
-
|
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
|
data/lib/mime_actor/callbacks.rb
CHANGED
@@ -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
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
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
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
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
|
|
data/lib/mime_actor/scene.rb
CHANGED
@@ -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
|
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
|
data/lib/mime_actor/version.rb
CHANGED
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.
|
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-
|
11
|
+
date: 2024-08-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: actionpack
|