softwear-lib 1.7.20 → 1.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/softwear/lib/enqueue.rb +14 -2
- data/lib/softwear/lib/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4ba997cdcca4c738dc0e92953c7a3193541fd256
|
4
|
+
data.tar.gz: de8293816825a71c8864c9539a9df853c15017d9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f1b075f5da35bb6d56e9baa1c9e2f271931d02c23cd16b53da3ce5a83ad4b87edc756c977898d58cf3c7d8b36e8e01d663533de15420fd8069583df4c561f019
|
7
|
+
data.tar.gz: 444516f41f32cda04746f9b1900ac2b7061cdceca7d89335e8186e1ee2889387b3508009bd3803ce5c6643d040387fff4aa6e7a8f8bd773f04c2732ca09d49c6
|
data/lib/softwear/lib/enqueue.rb
CHANGED
@@ -3,6 +3,14 @@ module Softwear
|
|
3
3
|
module Enqueue
|
4
4
|
extend ActiveSupport::Concern
|
5
5
|
|
6
|
+
class Worker
|
7
|
+
include Sidekiq::Worker
|
8
|
+
|
9
|
+
def perform(model_name, id, method, *args)
|
10
|
+
model_name.constantize.find(id).send(method, *args)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
6
14
|
module ClassMethods
|
7
15
|
def enqueue(*method_names)
|
8
16
|
if method_names.last.is_a?(Hash)
|
@@ -22,11 +30,15 @@ module Softwear
|
|
22
30
|
if Rails.env.production?
|
23
31
|
class_eval <<-RUBY, __FILE__, __LINE__ + 1
|
24
32
|
def self.enqueue_#{method_name}(id, *args)
|
25
|
-
|
33
|
+
Sidekiq::Client.push(
|
34
|
+
'class' => ::Softwear::Lib::Enqueue::Worker,
|
35
|
+
'args' => [name, id, #{method_name.inspect}] + args,
|
36
|
+
'queue' => #{options[:queue]}
|
37
|
+
)
|
26
38
|
end
|
27
39
|
|
28
40
|
def enqueue_#{method_name}(*args)
|
29
|
-
self.class.
|
41
|
+
self.class.enqueue_#{method_name}(*args)
|
30
42
|
end
|
31
43
|
RUBY
|
32
44
|
else
|
data/lib/softwear/lib/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: softwear-lib
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.8.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nigel Baillie
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-05-
|
11
|
+
date: 2016-05-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|