softwear-lib 1.5.18 → 1.6.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.
- checksums.yaml +4 -4
- data/lib/softwear/lib.rb +1 -0
- data/lib/softwear/lib/enqueue.rb +43 -0
- data/lib/softwear/lib/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7c92f67925ede2d2f867e58f35c9876c4a76aec0
|
4
|
+
data.tar.gz: 0ac6df7cbc4ec06ced8272f6622f0520083cdb0c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 490021eaa64df66ed8bf25367c9b07cfcbae2d375183931d1b363fe1129a78a01ec66dc5937c9536570d7eb0ed14cac96f78ab352cdd4a6a3cbc3105c0a2e347
|
7
|
+
data.tar.gz: da6d0b87e6649e946b168ef33c6859a18cd39de07517230062a060fac9a3d62736f3affcd07208c0bacb1f4fcdf8f7c1223d1aaa7047540a74a207e056e9dbcd
|
data/lib/softwear/lib.rb
CHANGED
@@ -0,0 +1,43 @@
|
|
1
|
+
module Softwear
|
2
|
+
module Lib
|
3
|
+
module Enqueue
|
4
|
+
extend ActiveSupport::Concern
|
5
|
+
|
6
|
+
module ClassMethods
|
7
|
+
def enqueue(*method_names)
|
8
|
+
if method_names.last.is_a?(Hash)
|
9
|
+
options = method_names.pop
|
10
|
+
else
|
11
|
+
options = {}
|
12
|
+
end
|
13
|
+
|
14
|
+
method_names.each do |method_name|
|
15
|
+
class_eval <<-RUBY, __FILE__, __LINE__ + 1
|
16
|
+
def self.#{method_name}(id, *args)
|
17
|
+
find(id).#{method_name}(*args)
|
18
|
+
end
|
19
|
+
RUBY
|
20
|
+
|
21
|
+
if Rails.env.production?
|
22
|
+
class_eval <<-RUBY, __FILE__, __LINE__ + 1
|
23
|
+
def enqueue_#{method_name}(*args)
|
24
|
+
self.class.delay(#{options.inspect}).#{method_name}(id, *args)
|
25
|
+
end
|
26
|
+
RUBY
|
27
|
+
else
|
28
|
+
class_eval <<-RUBY, __FILE__, __LINE__ + 1
|
29
|
+
def enqueue_#{method_name}(*args)
|
30
|
+
self.#{method_name}(*args)
|
31
|
+
end
|
32
|
+
RUBY
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
included do
|
39
|
+
extend ClassMethods
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
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.6.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-02-
|
11
|
+
date: 2016-02-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -93,6 +93,7 @@ files:
|
|
93
93
|
- lib/softwear/lib/api_controller.rb
|
94
94
|
- lib/softwear/lib/capistrano.rb
|
95
95
|
- lib/softwear/lib/controller_authentication.rb
|
96
|
+
- lib/softwear/lib/enqueue.rb
|
96
97
|
- lib/softwear/lib/spec.rb
|
97
98
|
- lib/softwear/lib/version.rb
|
98
99
|
- softwear-lib.gemspec
|