snfoil 0.9.1 → 1.0.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.
Files changed (41) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +5 -0
  3. data/Gemfile +6 -0
  4. data/LICENSE.txt +201 -0
  5. data/README.md +95 -505
  6. data/docs/build-context.md +56 -0
  7. data/docs/create-context.md +109 -0
  8. data/docs/destroy-context.md +102 -0
  9. data/docs/index-context.md +70 -0
  10. data/docs/show-context.md +71 -0
  11. data/docs/update-context.md +107 -0
  12. data/lib/snfoil/adapters/orms/active_record.rb +46 -0
  13. data/lib/{sn_foil → snfoil}/adapters/orms/base_adapter.rb +15 -1
  14. data/lib/snfoil/crud/build_context.rb +49 -0
  15. data/lib/snfoil/crud/change_context.rb +48 -0
  16. data/lib/snfoil/crud/context.rb +41 -0
  17. data/lib/snfoil/crud/create_context.rb +45 -0
  18. data/lib/snfoil/crud/destroy_context.rb +57 -0
  19. data/lib/snfoil/crud/index_context.rb +46 -0
  20. data/lib/snfoil/crud/setup_context.rb +90 -0
  21. data/lib/snfoil/crud/show_context.rb +52 -0
  22. data/lib/snfoil/crud/update_context.rb +60 -0
  23. data/lib/snfoil/version.rb +19 -0
  24. data/lib/snfoil.rb +69 -0
  25. data/snfoil.gemspec +47 -0
  26. metadata +205 -23
  27. data/Rakefile +0 -4
  28. data/lib/sn_foil/adapters/orms/active_record.rb +0 -32
  29. data/lib/sn_foil/context.rb +0 -24
  30. data/lib/sn_foil/contexts/build_context.rb +0 -68
  31. data/lib/sn_foil/contexts/change_context.rb +0 -101
  32. data/lib/sn_foil/contexts/create_context.rb +0 -158
  33. data/lib/sn_foil/contexts/destroy_context.rb +0 -165
  34. data/lib/sn_foil/contexts/index_context.rb +0 -64
  35. data/lib/sn_foil/contexts/setup_context.rb +0 -119
  36. data/lib/sn_foil/contexts/show_context.rb +0 -62
  37. data/lib/sn_foil/contexts/update_context.rb +0 -169
  38. data/lib/sn_foil/policy.rb +0 -55
  39. data/lib/sn_foil/searcher.rb +0 -119
  40. data/lib/sn_foil/version.rb +0 -5
  41. data/lib/sn_foil.rb +0 -49
metadata CHANGED
@@ -1,15 +1,16 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: snfoil
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.1
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matthew Howes
8
8
  - Danny Murphy
9
9
  - Cliff Campbell
10
- bindir: bin
10
+ autorequire:
11
+ bindir: exe
11
12
  cert_chain: []
12
- date: 1980-01-02 00:00:00.000000000 Z
13
+ date: 2022-05-18 00:00:00.000000000 Z
13
14
  dependencies:
14
15
  - !ruby/object:Gem::Dependency
15
16
  name: activesupport
@@ -53,6 +54,175 @@ dependencies:
53
54
  - - "~>"
54
55
  - !ruby/object:Gem::Version
55
56
  version: '2.0'
57
+ - !ruby/object:Gem::Dependency
58
+ name: snfoil-context
59
+ requirement: !ruby/object:Gem::Requirement
60
+ requirements:
61
+ - - "~>"
62
+ - !ruby/object:Gem::Version
63
+ version: '1.0'
64
+ type: :runtime
65
+ prerelease: false
66
+ version_requirements: !ruby/object:Gem::Requirement
67
+ requirements:
68
+ - - "~>"
69
+ - !ruby/object:Gem::Version
70
+ version: '1.0'
71
+ - !ruby/object:Gem::Dependency
72
+ name: snfoil-policy
73
+ requirement: !ruby/object:Gem::Requirement
74
+ requirements:
75
+ - - "~>"
76
+ - !ruby/object:Gem::Version
77
+ version: '1.0'
78
+ type: :runtime
79
+ prerelease: false
80
+ version_requirements: !ruby/object:Gem::Requirement
81
+ requirements:
82
+ - - "~>"
83
+ - !ruby/object:Gem::Version
84
+ version: '1.0'
85
+ - !ruby/object:Gem::Dependency
86
+ name: snfoil-searcher
87
+ requirement: !ruby/object:Gem::Requirement
88
+ requirements:
89
+ - - "~>"
90
+ - !ruby/object:Gem::Version
91
+ version: '1.0'
92
+ type: :runtime
93
+ prerelease: false
94
+ version_requirements: !ruby/object:Gem::Requirement
95
+ requirements:
96
+ - - "~>"
97
+ - !ruby/object:Gem::Version
98
+ version: '1.0'
99
+ - !ruby/object:Gem::Dependency
100
+ name: bundle-audit
101
+ requirement: !ruby/object:Gem::Requirement
102
+ requirements:
103
+ - - "~>"
104
+ - !ruby/object:Gem::Version
105
+ version: 0.1.0
106
+ type: :development
107
+ prerelease: false
108
+ version_requirements: !ruby/object:Gem::Requirement
109
+ requirements:
110
+ - - "~>"
111
+ - !ruby/object:Gem::Version
112
+ version: 0.1.0
113
+ - !ruby/object:Gem::Dependency
114
+ name: dry-struct
115
+ requirement: !ruby/object:Gem::Requirement
116
+ requirements:
117
+ - - "~>"
118
+ - !ruby/object:Gem::Version
119
+ version: '1.0'
120
+ type: :development
121
+ prerelease: false
122
+ version_requirements: !ruby/object:Gem::Requirement
123
+ requirements:
124
+ - - "~>"
125
+ - !ruby/object:Gem::Version
126
+ version: '1.0'
127
+ - !ruby/object:Gem::Dependency
128
+ name: fasterer
129
+ requirement: !ruby/object:Gem::Requirement
130
+ requirements:
131
+ - - "~>"
132
+ - !ruby/object:Gem::Version
133
+ version: 0.10.0
134
+ type: :development
135
+ prerelease: false
136
+ version_requirements: !ruby/object:Gem::Requirement
137
+ requirements:
138
+ - - "~>"
139
+ - !ruby/object:Gem::Version
140
+ version: 0.10.0
141
+ - !ruby/object:Gem::Dependency
142
+ name: pry-byebug
143
+ requirement: !ruby/object:Gem::Requirement
144
+ requirements:
145
+ - - "~>"
146
+ - !ruby/object:Gem::Version
147
+ version: '3.9'
148
+ type: :development
149
+ prerelease: false
150
+ version_requirements: !ruby/object:Gem::Requirement
151
+ requirements:
152
+ - - "~>"
153
+ - !ruby/object:Gem::Version
154
+ version: '3.9'
155
+ - !ruby/object:Gem::Dependency
156
+ name: rake
157
+ requirement: !ruby/object:Gem::Requirement
158
+ requirements:
159
+ - - "~>"
160
+ - !ruby/object:Gem::Version
161
+ version: '13.0'
162
+ type: :development
163
+ prerelease: false
164
+ version_requirements: !ruby/object:Gem::Requirement
165
+ requirements:
166
+ - - "~>"
167
+ - !ruby/object:Gem::Version
168
+ version: '13.0'
169
+ - !ruby/object:Gem::Dependency
170
+ name: rspec
171
+ requirement: !ruby/object:Gem::Requirement
172
+ requirements:
173
+ - - "~>"
174
+ - !ruby/object:Gem::Version
175
+ version: '3.9'
176
+ type: :development
177
+ prerelease: false
178
+ version_requirements: !ruby/object:Gem::Requirement
179
+ requirements:
180
+ - - "~>"
181
+ - !ruby/object:Gem::Version
182
+ version: '3.9'
183
+ - !ruby/object:Gem::Dependency
184
+ name: rubocop
185
+ requirement: !ruby/object:Gem::Requirement
186
+ requirements:
187
+ - - "~>"
188
+ - !ruby/object:Gem::Version
189
+ version: '1.29'
190
+ type: :development
191
+ prerelease: false
192
+ version_requirements: !ruby/object:Gem::Requirement
193
+ requirements:
194
+ - - "~>"
195
+ - !ruby/object:Gem::Version
196
+ version: '1.29'
197
+ - !ruby/object:Gem::Dependency
198
+ name: rubocop-performance
199
+ requirement: !ruby/object:Gem::Requirement
200
+ requirements:
201
+ - - "~>"
202
+ - !ruby/object:Gem::Version
203
+ version: '1.11'
204
+ type: :development
205
+ prerelease: false
206
+ version_requirements: !ruby/object:Gem::Requirement
207
+ requirements:
208
+ - - "~>"
209
+ - !ruby/object:Gem::Version
210
+ version: '1.11'
211
+ - !ruby/object:Gem::Dependency
212
+ name: rubocop-rspec
213
+ requirement: !ruby/object:Gem::Requirement
214
+ requirements:
215
+ - - "~>"
216
+ - !ruby/object:Gem::Version
217
+ version: '2.4'
218
+ type: :development
219
+ prerelease: false
220
+ version_requirements: !ruby/object:Gem::Requirement
221
+ requirements:
222
+ - - "~>"
223
+ - !ruby/object:Gem::Version
224
+ version: '2.4'
225
+ description: A collection of SnFoil gems and additional helper classes
56
226
  email:
57
227
  - howeszy@gmail.com
58
228
  - dmurph24@gmail.com
@@ -61,30 +231,41 @@ executables: []
61
231
  extensions: []
62
232
  extra_rdoc_files: []
63
233
  files:
234
+ - CHANGELOG.md
64
235
  - CODE_OF_CONDUCT.md
236
+ - Gemfile
237
+ - LICENSE.txt
65
238
  - README.md
66
- - Rakefile
67
239
  - TODO.md
68
- - lib/sn_foil.rb
69
- - lib/sn_foil/adapters/orms/active_record.rb
70
- - lib/sn_foil/adapters/orms/base_adapter.rb
71
- - lib/sn_foil/context.rb
72
- - lib/sn_foil/contexts/build_context.rb
73
- - lib/sn_foil/contexts/change_context.rb
74
- - lib/sn_foil/contexts/create_context.rb
75
- - lib/sn_foil/contexts/destroy_context.rb
76
- - lib/sn_foil/contexts/index_context.rb
77
- - lib/sn_foil/contexts/setup_context.rb
78
- - lib/sn_foil/contexts/show_context.rb
79
- - lib/sn_foil/contexts/update_context.rb
80
- - lib/sn_foil/policy.rb
81
- - lib/sn_foil/searcher.rb
82
- - lib/sn_foil/version.rb
240
+ - docs/build-context.md
241
+ - docs/create-context.md
242
+ - docs/destroy-context.md
243
+ - docs/index-context.md
244
+ - docs/show-context.md
245
+ - docs/update-context.md
246
+ - lib/snfoil.rb
247
+ - lib/snfoil/adapters/orms/active_record.rb
248
+ - lib/snfoil/adapters/orms/base_adapter.rb
249
+ - lib/snfoil/crud/build_context.rb
250
+ - lib/snfoil/crud/change_context.rb
251
+ - lib/snfoil/crud/context.rb
252
+ - lib/snfoil/crud/create_context.rb
253
+ - lib/snfoil/crud/destroy_context.rb
254
+ - lib/snfoil/crud/index_context.rb
255
+ - lib/snfoil/crud/setup_context.rb
256
+ - lib/snfoil/crud/show_context.rb
257
+ - lib/snfoil/crud/update_context.rb
258
+ - lib/snfoil/version.rb
259
+ - snfoil.gemspec
83
260
  homepage: https://github.com/limited-effort/snfoil
84
261
  licenses:
85
- - MIT
262
+ - Apache-2.0
86
263
  metadata:
264
+ homepage_uri: https://github.com/limited-effort/snfoil
265
+ source_code_uri: https://github.com/limited-effort/snfoil
266
+ changelog_uri: https://github.com/limited-effort/snfoil/blob/main/CHANGELOG.md
87
267
  rubygems_mfa_required: 'true'
268
+ post_install_message:
88
269
  rdoc_options: []
89
270
  require_paths:
90
271
  - lib
@@ -92,14 +273,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
92
273
  requirements:
93
274
  - - ">="
94
275
  - !ruby/object:Gem::Version
95
- version: '3.0'
276
+ version: '2.7'
96
277
  required_rubygems_version: !ruby/object:Gem::Requirement
97
278
  requirements:
98
279
  - - ">="
99
280
  - !ruby/object:Gem::Version
100
281
  version: '0'
101
282
  requirements: []
102
- rubygems_version: 3.6.9
283
+ rubygems_version: 3.1.6
284
+ signing_key:
103
285
  specification_version: 4
104
- summary: A boilerplate gem for providing basic contexts
286
+ summary: A Toolbox of Context Behaviors
105
287
  test_files: []
data/Rakefile DELETED
@@ -1,4 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'bundler/gem_tasks'
4
- task default: :spec
@@ -1,32 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative 'base_adapter'
4
-
5
- module SnFoil
6
- module Adapters
7
- module ORMs
8
- class ActiveRecord < SnFoil::Adapters::ORMs::BaseAdapter
9
- def new(**params)
10
- self.class.new(__getobj__.new(params))
11
- end
12
-
13
- def all
14
- __getobj__.all
15
- end
16
-
17
- def save
18
- __getobj__.save
19
- end
20
-
21
- def destroy # rubocop:disable Naming/PredicateMethod -- reason: This is a method that calls the underlying ActiveRecord method
22
- __getobj__.destroy
23
- __getobj__.destroyed?
24
- end
25
-
26
- def attributes=(attributes)
27
- __getobj__.attributes = attributes
28
- end
29
- end
30
- end
31
- end
32
- end
@@ -1,24 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'active_support/concern'
4
- require_relative 'contexts/build_context'
5
- require_relative 'contexts/index_context'
6
- require_relative 'contexts/show_context'
7
- require_relative 'contexts/create_context'
8
- require_relative 'contexts/update_context'
9
- require_relative 'contexts/destroy_context'
10
-
11
- module SnFoil
12
- module Context
13
- extend ActiveSupport::Concern
14
-
15
- included do
16
- include Contexts::BuildContext
17
- include Contexts::IndexContext
18
- include Contexts::ShowContext
19
- include Contexts::CreateContext
20
- include Contexts::UpdateContext
21
- include Contexts::DestroyContext
22
- end
23
- end
24
- end
@@ -1,68 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'active_support/concern'
4
- require_relative 'setup_context'
5
-
6
- module SnFoil
7
- module Contexts
8
- module BuildContext
9
- extend ActiveSupport::Concern
10
-
11
- included do
12
- include SetupContext
13
- end
14
-
15
- class_methods do
16
- attr_reader :i_setup_build_hooks
17
-
18
- def build(params:, entity: nil, **options)
19
- new(entity).build(**options, params: params)
20
- end
21
-
22
- def setup_build(method = nil, **options, &block)
23
- raise ArgumentError, '#setup_build requires either a method name or a block' if method.nil? && block.nil?
24
-
25
- (@i_setup_build_hooks ||= []) << { method: method, block: block, if: options[:if], unless: options[:unless] }
26
- end
27
- end
28
-
29
- def setup_build_object(params: {}, object: nil, **options)
30
- object = if object
31
- wrap_object(object)
32
- else
33
- klass = options.fetch(:model) { model }
34
- wrap_object(klass).new
35
- end
36
-
37
- object.attributes = params
38
- options[:object] = object
39
- options
40
- end
41
-
42
- def build(**options)
43
- options[:action] = :build
44
- options = before_setup_build_object(**options)
45
- options = setup_build_object(**options)
46
- authorize(options[:object], options[:authorize], **options) if options[:authorize]
47
- unwrap_object(options[:object])
48
- end
49
-
50
- def setup_build(**options)
51
- options
52
- end
53
-
54
- def setup_build_hooks
55
- self.class.i_setup_build_hooks || []
56
- end
57
-
58
- private
59
-
60
- def before_setup_build_object(**options)
61
- options = setup(**options)
62
- options = setup_hooks.reduce(options) { |opts, hook| run_hook(hook, **opts) }
63
- options = setup_build(**options)
64
- setup_build_hooks.reduce(options) { |opts, hook| run_hook(hook, **opts) }
65
- end
66
- end
67
- end
68
- end
@@ -1,101 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'active_support/concern'
4
- require_relative 'setup_context'
5
-
6
- module SnFoil
7
- module Contexts
8
- module ChangeContext
9
- extend ActiveSupport::Concern
10
-
11
- included do
12
- include SetupContext
13
- end
14
-
15
- class_methods do # rubocop:disable Metrics/BlockLength
16
- attr_reader :i_params, :i_setup_change_hooks, :i_before_change_hooks, :i_after_change_hooks,
17
- :i_after_change_success_hooks, :i_after_change_failure_hooks
18
-
19
- def params(*permitted_params)
20
- @i_params ||= []
21
- @i_params |= permitted_params
22
- end
23
-
24
- def setup_change(method = nil, **options, &block)
25
- raise ArgumentError, '#setup_change requires either a method name or a block' if method.nil? && block.nil?
26
-
27
- (@i_setup_change_hooks ||= []) << { method: method, block: block, if: options[:if], unless: options[:unless] }
28
- end
29
-
30
- def before_change(method = nil, **options, &block)
31
- raise ArgumentError, '#before_change requires either a method name or a block' if method.nil? && block.nil?
32
-
33
- (@i_before_change_hooks ||= []) << { method: method, block: block, if: options[:if], unless: options[:unless] }
34
- end
35
-
36
- def after_change(method = nil, **options, &block)
37
- raise ArgumentError, '#after_change requires either a method name or a block' if method.nil? && block.nil?
38
-
39
- (@i_after_change_hooks ||= []) << { method: method, block: block, if: options[:if], unless: options[:unless] }
40
- end
41
-
42
- def after_change_success(method = nil, **options, &block)
43
- raise ArgumentError, '#after_change_success requires either a method name or a block' if method.nil? && block.nil?
44
-
45
- (@i_after_change_success_hooks ||= []) << { method: method, block: block, if: options[:if], unless: options[:unless] }
46
- end
47
-
48
- def after_change_failure(method = nil, **options, &block)
49
- raise ArgumentError, '#after_change_failure requires either a method name or a block' if method.nil? && block.nil?
50
-
51
- (@i_after_change_failure_hooks ||= []) << { method: method, block: block, if: options[:if], unless: options[:unless] }
52
- end
53
- end
54
-
55
- def param_names
56
- @param_names ||= self.class.i_params
57
- end
58
-
59
- def setup_change(**options)
60
- options[:params] = options[:params].select { |params| param_names.include?(params) } if param_names
61
- options
62
- end
63
-
64
- def before_change(**options)
65
- options
66
- end
67
-
68
- def after_change(**options)
69
- options
70
- end
71
-
72
- def after_change_success(**options)
73
- options
74
- end
75
-
76
- def after_change_failure(**options)
77
- options
78
- end
79
-
80
- def setup_change_hooks
81
- self.class.i_setup_change_hooks || []
82
- end
83
-
84
- def before_change_hooks
85
- self.class.i_before_change_hooks || []
86
- end
87
-
88
- def after_change_hooks
89
- self.class.i_after_change_hooks || []
90
- end
91
-
92
- def after_change_success_hooks
93
- self.class.i_after_change_success_hooks || []
94
- end
95
-
96
- def after_change_failure_hooks
97
- self.class.i_after_change_failure_hooks || []
98
- end
99
- end
100
- end
101
- end
@@ -1,158 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'active_support/concern'
4
- require_relative 'change_context'
5
-
6
- module SnFoil
7
- module Contexts
8
- module CreateContext # rubocop:disable Metrics/ModuleLength
9
- extend ActiveSupport::Concern
10
-
11
- included do
12
- include BuildContext
13
- include ChangeContext
14
-
15
- alias_method :setup_create_object, :setup_build_object
16
- end
17
-
18
- class_methods do
19
- attr_reader :i_setup_create_hooks, :i_before_create_hooks, :i_after_create_hooks,
20
- :i_after_create_success_hooks, :i_after_create_failure_hooks
21
-
22
- def create(params:, entity: nil, **options)
23
- new(entity).create(**options, params: params)
24
- end
25
-
26
- def setup_create(method = nil, **options, &block)
27
- raise ArgumentError, '#setup_create requires either a method name or a block' if method.nil? && block.nil?
28
-
29
- (@i_setup_create_hooks ||= []) << { method: method, block: block, if: options[:if], unless: options[:unless] }
30
- end
31
-
32
- def before_create(method = nil, **options, &block)
33
- raise ArgumentError, '#before_create requires either a method name or a block' if method.nil? && block.nil?
34
-
35
- (@i_before_create_hooks ||= []) << { method: method, block: block, if: options[:if], unless: options[:unless] }
36
- end
37
-
38
- def after_create(method = nil, **options, &block)
39
- raise ArgumentError, '#after_create requires either a method name or a block' if method.nil? && block.nil?
40
-
41
- (@i_after_create_hooks ||= []) << { method: method, block: block, if: options[:if], unless: options[:unless] }
42
- end
43
-
44
- def after_create_success(method = nil, **options, &block)
45
- raise ArgumentError, '#after_create_success requires either a method name or a block' if method.nil? && block.nil?
46
-
47
- (@i_after_create_success_hooks ||= []) << { method: method, block: block, if: options[:if], unless: options[:unless] }
48
- end
49
-
50
- def after_create_failure(method = nil, **options, &block)
51
- raise ArgumentError, '#after_create_failure requires either a method name or a block' if method.nil? && block.nil?
52
-
53
- (@i_after_create_failure_hooks ||= []) << { method: method, block: block, if: options[:if], unless: options[:unless] }
54
- end
55
- end
56
-
57
- def create(**options)
58
- options[:action] = :create
59
- options = before_setup_build_object(**options)
60
- options = before_setup_create_object(**options)
61
- options = setup_create_object(**options)
62
- authorize(options[:object], options.fetch(:authorize, :create?), **options)
63
- options = create_hooks(**options)
64
- options[:object]
65
- end
66
-
67
- def setup_create(**options)
68
- options
69
- end
70
-
71
- def before_create(**options)
72
- options
73
- end
74
-
75
- def after_create(**options)
76
- options
77
- end
78
-
79
- def after_create_success(**options)
80
- options
81
- end
82
-
83
- def after_create_failure(**options)
84
- options
85
- end
86
-
87
- def setup_create_hooks
88
- self.class.i_setup_create_hooks || []
89
- end
90
-
91
- def before_create_hooks
92
- self.class.i_before_create_hooks || []
93
- end
94
-
95
- def after_create_hooks
96
- self.class.i_after_create_hooks || []
97
- end
98
-
99
- def after_create_success_hooks
100
- self.class.i_after_create_success_hooks || []
101
- end
102
-
103
- def after_create_failure_hooks
104
- self.class.i_after_create_failure_hooks || []
105
- end
106
-
107
- private
108
-
109
- def before_setup_create_object(**options)
110
- options = setup_change(**options)
111
- options = setup_change_hooks.reduce(options) { |opts, hook| run_hook(hook, **opts) }
112
- options = setup_create(**options)
113
- setup_create_hooks.reduce(options) { |opts, hook| run_hook(hook, **opts) }
114
- end
115
-
116
- # This method is private to help protect the order of execution of hooks
117
- def create_hooks(options)
118
- options = before_create_save(**options)
119
- save_successful = options[:object].save
120
- options[:object] = unwrap_object(options[:object])
121
- options = if save_successful
122
- after_create_save_success(**options)
123
- else
124
- after_create_save_failure(**options)
125
- end
126
- after_create_save(**options)
127
- end
128
-
129
- def before_create_save(**options)
130
- options = before_change(**options)
131
- options = before_change_hooks.reduce(options) { |opts, hook| run_hook(hook, **opts) }
132
- options = before_create(**options)
133
- before_create_hooks.reduce(options) { |opts, hook| run_hook(hook, **opts) }
134
- end
135
-
136
- def after_create_save(**options)
137
- options = after_change(**options)
138
- options = after_change_hooks.reduce(options) { |opts, hook| run_hook(hook, **opts) }
139
- options = after_create(**options)
140
- after_create_hooks.reduce(options) { |opts, hook| run_hook(hook, **opts) }
141
- end
142
-
143
- def after_create_save_success(**options)
144
- options = after_change_success(**options)
145
- options = after_change_success_hooks.reduce(options) { |opts, hook| run_hook(hook, **opts) }
146
- options = after_create_success(**options)
147
- after_create_success_hooks.reduce(options) { |opts, hook| run_hook(hook, **opts) }
148
- end
149
-
150
- def after_create_save_failure(**options)
151
- options = after_change_failure(**options)
152
- options = after_change_failure_hooks.reduce(options) { |opts, hook| run_hook(hook, **opts) }
153
- options = after_create_failure(**options)
154
- after_create_failure_hooks.reduce(options) { |opts, hook| run_hook(hook, **opts) }
155
- end
156
- end
157
- end
158
- end