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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 62c06810e83085229c80a0864e9286db8c131ca4
4
- data.tar.gz: 293e74070abcfb3eb12464c186d99741f41369e6
3
+ metadata.gz: 7c92f67925ede2d2f867e58f35c9876c4a76aec0
4
+ data.tar.gz: 0ac6df7cbc4ec06ced8272f6622f0520083cdb0c
5
5
  SHA512:
6
- metadata.gz: 5d633565fdf572e331aa173fdb4c5f9f4f5eba77c20c62b92f5d2dee718c6c9b87e6d2f89710ad4f14d4b8045aaf92a61927f13f6b06b9dfb071ba163d293327
7
- data.tar.gz: 8ebccb5e954cfc503cfdc386d6942aa6176e2fde17f1e28bf114bf65b517571dbdfccbfe272e75ba143f8b4f3c1a028d96344860ef91690aa605ca09eedf0073
6
+ metadata.gz: 490021eaa64df66ed8bf25367c9b07cfcbae2d375183931d1b363fe1129a78a01ec66dc5937c9536570d7eb0ed14cac96f78ab352cdd4a6a3cbc3105c0a2e347
7
+ data.tar.gz: da6d0b87e6649e946b168ef33c6859a18cd39de07517230062a060fac9a3d62736f3affcd07208c0bacb1f4fcdf8f7c1223d1aaa7047540a74a207e056e9dbcd
data/lib/softwear/lib.rb CHANGED
@@ -1,6 +1,7 @@
1
1
  require "softwear/lib/version"
2
2
  require "softwear/lib/spec"
3
3
  require "softwear/lib/api_controller"
4
+ require "softwear/lib/enqueue"
4
5
 
5
6
  require "softwear/lib/controller_authentication"
6
7
  require "softwear/auth/helper"
@@ -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
@@ -1,5 +1,5 @@
1
1
  module Softwear
2
2
  module Lib
3
- VERSION = "1.5.18"
3
+ VERSION = "1.6.0"
4
4
  end
5
5
  end
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.5.18
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-24 00:00:00.000000000 Z
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