active_model_jobs 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.ruby-version +1 -1
- data/README.md +12 -1
- data/active_model_jobs.gemspec +5 -3
- data/lib/active_model/jobs.rb +4 -1
- data/lib/active_model/jobs/engine.rb +2 -0
- data/lib/active_model/jobs/version.rb +1 -1
- data/lib/active_model_jobs.rb +1 -0
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 3d5d51b121fac8f97da88d4fde106b161c028597720c796389b268a5f3708576
|
4
|
+
data.tar.gz: 6d918ba5a66c5894e02d9039dfc898ed83d8cd3a732ce792f95e14a740078167
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4ba71525672b619b49f2353f6ad22efebd21dd2b1905fd7dd02cd30606e0be0f9efbe457c9afce2e643bd119458451e896b6857a0ed495ea8cb421e787ab1f79
|
7
|
+
data.tar.gz: 9aa14ac5cf1656a7dfdb9d57891d797c8ba6117045d98e78442b6fc523023ad1ba714036256c7d51b9b373d054e8861ae293116952ecccf9f208442e78cbd1f3
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.
|
1
|
+
2.3.8
|
data/README.md
CHANGED
@@ -20,12 +20,23 @@ Add this line to your application's Gemfile:
|
|
20
20
|
gem 'active_model-jobs'
|
21
21
|
```
|
22
22
|
|
23
|
-
And then
|
23
|
+
And then run:
|
24
24
|
|
25
25
|
```bash
|
26
26
|
$ bundle
|
27
27
|
```
|
28
28
|
|
29
|
+
If you're using ActiveRecord, the `ActiveModel::Jobs` module will be
|
30
|
+
included in your models by default. For other ORMs or POROs that use
|
31
|
+
ActiveModel, you'll need to include the module yourself:
|
32
|
+
|
33
|
+
```ruby
|
34
|
+
class Model
|
35
|
+
include ActiveModel::Model
|
36
|
+
include ActiveModel::Jobs
|
37
|
+
end
|
38
|
+
```
|
39
|
+
|
29
40
|
## Usage
|
30
41
|
|
31
42
|
Given we already have a model called **Track**, generate a job
|
data/active_model_jobs.gemspec
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
lib = File.expand_path('lib', __dir__)
|
2
4
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
3
5
|
require 'active_model/jobs/version'
|
@@ -8,9 +10,9 @@ Gem::Specification.new do |spec|
|
|
8
10
|
spec.authors = ["Tom Scott"]
|
9
11
|
spec.email = ["tscott@weblinc.com"]
|
10
12
|
|
11
|
-
spec.summary =
|
12
|
-
spec.description =
|
13
|
-
spec.homepage = "http://github.com/tubbo/
|
13
|
+
spec.summary = 'Enqueue background jobs from model classes'
|
14
|
+
spec.description = spec.summary
|
15
|
+
spec.homepage = "http://github.com/tubbo/active_model_jobs"
|
14
16
|
spec.license = "MIT"
|
15
17
|
|
16
18
|
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
data/lib/active_model/jobs.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require "active_support/all"
|
2
4
|
require "active_model"
|
3
5
|
require "active_model/jobs/version"
|
@@ -17,7 +19,7 @@ module ActiveModel
|
|
17
19
|
# end
|
18
20
|
module Jobs
|
19
21
|
# Method suffix for actions.
|
20
|
-
ACTION_SUFFIX = '!'
|
22
|
+
ACTION_SUFFIX = '!'
|
21
23
|
|
22
24
|
# Call +perform_later+ on an ActiveJob class corresponding to an
|
23
25
|
# undefined action method name. Most of the work here is done in the
|
@@ -33,6 +35,7 @@ module ActiveModel
|
|
33
35
|
performer = Performer.new method, model_name
|
34
36
|
return super unless respond_to?(method) && performer.job?
|
35
37
|
|
38
|
+
self.class.define_method(method) { performer.call self }
|
36
39
|
performer.call self
|
37
40
|
end
|
38
41
|
|
@@ -0,0 +1 @@
|
|
1
|
+
require 'active_model/jobs'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: active_model_jobs
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tom Scott
|
@@ -122,7 +122,7 @@ dependencies:
|
|
122
122
|
- - ">="
|
123
123
|
- !ruby/object:Gem::Version
|
124
124
|
version: 5.0.0
|
125
|
-
description: Enqueue
|
125
|
+
description: Enqueue background jobs from model classes
|
126
126
|
email:
|
127
127
|
- tscott@weblinc.com
|
128
128
|
executables: []
|
@@ -159,7 +159,8 @@ files:
|
|
159
159
|
- lib/active_model/jobs/engine.rb
|
160
160
|
- lib/active_model/jobs/performer.rb
|
161
161
|
- lib/active_model/jobs/version.rb
|
162
|
-
|
162
|
+
- lib/active_model_jobs.rb
|
163
|
+
homepage: http://github.com/tubbo/active_model_jobs
|
163
164
|
licenses:
|
164
165
|
- MIT
|
165
166
|
metadata: {}
|
@@ -178,9 +179,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
178
179
|
- !ruby/object:Gem::Version
|
179
180
|
version: '0'
|
180
181
|
requirements: []
|
181
|
-
|
182
|
-
rubygems_version: 2.4.5
|
182
|
+
rubygems_version: 3.0.4
|
183
183
|
signing_key:
|
184
184
|
specification_version: 4
|
185
|
-
summary: Enqueue
|
185
|
+
summary: Enqueue background jobs from model classes
|
186
186
|
test_files: []
|