dalliance 0.3.4 → 0.4.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/gemfiles/rails_3.2.gemfile.lock +1 -1
- data/gemfiles/rails_4.0.gemfile.lock +1 -1
- data/gemfiles/rails_4.1.gemfile.lock +1 -1
- data/gemfiles/rails_4.2.gemfile.lock +1 -1
- data/lib/dalliance.rb +9 -1
- data/lib/dalliance/version.rb +2 -2
- data/spec/dalliance/dalliance_spec.rb +26 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d31a75c5a62922080b8fe3c78d8ca1f4269370ae
|
4
|
+
data.tar.gz: ca8db2678a622de8635ce8b1c3f98071e207a6b9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1193c409c957dde6d9c4fb4d65cd5cc9774fc8450eff1eab6f38791746e13d67f4bd40798e3c3c87ac9f4b3533b4fc013a2c816df6593a3039208e34a2cebd4d
|
7
|
+
data.tar.gz: 78fc6807ba76c33748fcdc976edc66482caf33c89cd5a61f590c075918b1cede37f33d4d5188a7dfdfa2682bdeebd2e75adf704b9531674ad4de4466618b5cc6
|
data/lib/dalliance.rb
CHANGED
@@ -201,10 +201,18 @@ module Dalliance
|
|
201
201
|
pending? || processing?
|
202
202
|
end
|
203
203
|
|
204
|
+
def processing_queue
|
205
|
+
if self.class.dalliance_options[:queue].respond_to?(:call)
|
206
|
+
self.class.instance_exec self, &dalliance_options[:queue]
|
207
|
+
else
|
208
|
+
self.class.dalliance_options[:queue]
|
209
|
+
end
|
210
|
+
end
|
211
|
+
|
204
212
|
#Force backgound_processing w/ true
|
205
213
|
def dalliance_background_process(backgound_processing = nil)
|
206
214
|
if backgound_processing || (backgound_processing.nil? && self.class.dalliance_options[:background_processing])
|
207
|
-
self.class.dalliance_options[:worker_class].enqueue(self,
|
215
|
+
self.class.dalliance_options[:worker_class].enqueue(self, processing_queue)
|
208
216
|
else
|
209
217
|
dalliance_process(false)
|
210
218
|
end
|
data/lib/dalliance/version.rb
CHANGED
@@ -24,4 +24,30 @@ RSpec.describe 'Dalliance' do
|
|
24
24
|
expect(DallianceModel.human_attribute_name(:dalliance_status)).to eq ('Status')
|
25
25
|
end
|
26
26
|
end
|
27
|
+
|
28
|
+
context "processing_queue" do
|
29
|
+
before do
|
30
|
+
DallianceModel.dalliance_options[:queue] = queue
|
31
|
+
end
|
32
|
+
|
33
|
+
context "string" do
|
34
|
+
let(:queue) { 'dalliance_2'}
|
35
|
+
|
36
|
+
specify{ expect(subject.processing_queue).to eq(queue) }
|
37
|
+
end
|
38
|
+
|
39
|
+
context "proc" do
|
40
|
+
context "w/o args" do
|
41
|
+
let(:queue) { Proc.new{ 'dalliance_2' } }
|
42
|
+
|
43
|
+
specify{ expect(subject.processing_queue).to eq(queue.call) }
|
44
|
+
end
|
45
|
+
|
46
|
+
context "w/ args" do
|
47
|
+
let(:queue) { Proc.new{ |a,b,c| 'dalliance_2' } }
|
48
|
+
|
49
|
+
specify{ expect(subject.processing_queue).to eq(queue.call) }
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
27
53
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dalliance
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eric Sullivan
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-07-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -179,7 +179,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
179
179
|
version: '0'
|
180
180
|
requirements: []
|
181
181
|
rubyforge_project: dalliance
|
182
|
-
rubygems_version: 2.
|
182
|
+
rubygems_version: 2.6.14
|
183
183
|
signing_key:
|
184
184
|
specification_version: 4
|
185
185
|
summary: Wrapper for an ActiveRecord model with a single ascynhronous method
|