active_record-associated_object 0.3.0 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/Gemfile +2 -0
- data/Gemfile.lock +8 -1
- data/README.md +2 -0
- data/Rakefile +0 -9
- data/active_record-associated_object.gemspec +1 -2
- data/lib/active_record/associated_object/railtie.rb +2 -2
- data/lib/active_record/associated_object/version.rb +1 -1
- metadata +17 -4
- data/lib/active_record/associated_object/performs.rb +0 -36
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 20d91687ec83cbc70efb318377c15ce1e2e79b28d350322b0d91ad6618073cc2
|
4
|
+
data.tar.gz: 59f19eea143da23bd980f0d6bca5a96670e13c7859d0db860741bf314d949822
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a41fc155e625c0d04d01f39a55a6c80155b8e275abb1c9be9ef5fac6c927cd6c36b83a13a9f621c73c344b333b246bd86e76bb49773579b2605fb1d2ede636b3
|
7
|
+
data.tar.gz: 3de159d609ac4ab8eedbe03d681cd6d8295ca4831c7eb4430ca760f86dfa243906bd9c7d62cc2cd60cf44ba0aa271116114703bd59a784780260d4b961f3e725
|
data/CHANGELOG.md
CHANGED
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,8 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
active_record-associated_object (0.
|
4
|
+
active_record-associated_object (0.4.0)
|
5
|
+
active_job-performs
|
5
6
|
activerecord (>= 6.1)
|
6
7
|
|
7
8
|
GEM
|
@@ -20,6 +21,8 @@ GEM
|
|
20
21
|
erubi (~> 1.4)
|
21
22
|
rails-dom-testing (~> 2.0)
|
22
23
|
rails-html-sanitizer (~> 1.1, >= 1.2.0)
|
24
|
+
active_job-performs (0.1.1)
|
25
|
+
activejob (>= 6.1)
|
23
26
|
activejob (7.0.2.3)
|
24
27
|
activesupport (= 7.0.2.3)
|
25
28
|
globalid (>= 0.3.6)
|
@@ -55,10 +58,13 @@ GEM
|
|
55
58
|
nokogiri (>= 1.5.9)
|
56
59
|
method_source (1.0.0)
|
57
60
|
minitest (5.15.0)
|
61
|
+
minitest-sprint (1.2.2)
|
62
|
+
path_expander (~> 1.1)
|
58
63
|
nokogiri (1.13.4-arm64-darwin)
|
59
64
|
racc (~> 1.4)
|
60
65
|
nokogiri (1.13.4-x86_64-linux)
|
61
66
|
racc (~> 1.4)
|
67
|
+
path_expander (1.1.1)
|
62
68
|
racc (1.6.0)
|
63
69
|
rack (2.2.3)
|
64
70
|
rack-test (1.1.0)
|
@@ -95,6 +101,7 @@ DEPENDENCIES
|
|
95
101
|
debug
|
96
102
|
kredis
|
97
103
|
minitest (~> 5.0)
|
104
|
+
minitest-sprint (~> 1.2)
|
98
105
|
railties
|
99
106
|
rake (~> 13.0)
|
100
107
|
sqlite3
|
data/README.md
CHANGED
data/Rakefile
CHANGED
@@ -24,12 +24,11 @@ Gem::Specification.new do |spec|
|
|
24
24
|
(f == __FILE__) || f.match(%r{\A(?:(?:bin|test|spec|features)/|\.(?:git|travis|circleci)|appveyor)})
|
25
25
|
end
|
26
26
|
end
|
27
|
-
spec.bindir = "exe"
|
28
|
-
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
|
29
27
|
spec.require_paths = ["lib"]
|
30
28
|
|
31
29
|
# Uncomment to register a new dependency of your gem
|
32
30
|
spec.add_dependency "activerecord", ">= 6.1"
|
31
|
+
spec.add_dependency "active_job-performs"
|
33
32
|
|
34
33
|
# For more information and examples about making a new gem, check out our
|
35
34
|
# guide at: https://bundler.io/guides/creating_gem.html
|
@@ -4,8 +4,8 @@ class ActiveRecord::AssociatedObject::Railtie < Rails::Railtie
|
|
4
4
|
ActiveRecord::AssociatedObject.include GlobalID::Identification if defined?(GlobalID)
|
5
5
|
|
6
6
|
ActiveSupport.on_load :active_job do
|
7
|
-
require "
|
8
|
-
ActiveRecord::AssociatedObject.extend
|
7
|
+
require "active_job/performs"
|
8
|
+
ActiveRecord::AssociatedObject.extend ActiveJob::Performs
|
9
9
|
end
|
10
10
|
end
|
11
11
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: active_record-associated_object
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kasper Timm Hansen
|
8
8
|
autorequire:
|
9
|
-
bindir:
|
9
|
+
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-09-
|
11
|
+
date: 2022-09-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -24,6 +24,20 @@ dependencies:
|
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '6.1'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: active_job-performs
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
27
41
|
description:
|
28
42
|
email:
|
29
43
|
- hey@kaspth.com
|
@@ -40,7 +54,6 @@ files:
|
|
40
54
|
- active_record-associated_object.gemspec
|
41
55
|
- lib/active_record/associated_object.rb
|
42
56
|
- lib/active_record/associated_object/object_association.rb
|
43
|
-
- lib/active_record/associated_object/performs.rb
|
44
57
|
- lib/active_record/associated_object/railtie.rb
|
45
58
|
- lib/active_record/associated_object/version.rb
|
46
59
|
homepage: https://github.com/kaspth/active_record-associated_object
|
@@ -1,36 +0,0 @@
|
|
1
|
-
module ActiveRecord::AssociatedObject::Performs
|
2
|
-
def performs(method = nil, **configs, &block)
|
3
|
-
@job ||= safe_define("Job") { ApplicationJob }
|
4
|
-
|
5
|
-
if method.nil?
|
6
|
-
apply_performs_to(@job, **configs, &block)
|
7
|
-
else
|
8
|
-
job = safe_define("#{method}_job".classify) { @job }
|
9
|
-
apply_performs_to(job, **configs, &block)
|
10
|
-
|
11
|
-
job.class_eval <<~RUBY, __FILE__, __LINE__ + 1 unless job.instance_method(:perform).owner == job
|
12
|
-
def perform(object, *arguments, **options)
|
13
|
-
object.#{method}(*arguments, **options)
|
14
|
-
end
|
15
|
-
RUBY
|
16
|
-
|
17
|
-
class_eval <<~RUBY, __FILE__, __LINE__ + 1
|
18
|
-
def #{method}_later(*arguments, **options)
|
19
|
-
#{job}.perform_later(self, *arguments, **options)
|
20
|
-
end
|
21
|
-
RUBY
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
private
|
26
|
-
def safe_define(name)
|
27
|
-
name.safe_constantize || const_set(name, Class.new(yield))
|
28
|
-
end
|
29
|
-
|
30
|
-
def apply_performs_to(job_class, **configs, &block)
|
31
|
-
job_class.class_eval do
|
32
|
-
configs.each { public_send(_1, _2) }
|
33
|
-
yield if block_given?
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|