tire_async_index 0.2.0 → 0.2.1
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/Changelog.md +4 -0
- data/lib/tire_async_index/version.rb +1 -1
- data/lib/tire_async_index/workers/update_index.rb +11 -1
- data/spec/update_index_spec.rb +26 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ee879c3935e505e60740944e6c5b2227eaeff745
|
4
|
+
data.tar.gz: ae62e2506ff7edd585553ea10320c12c1683b11f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1a60f3de5dc39526a7128dbd38e76618db72c629ee1d71ca27453e95663a7d41ee7e3b461a300ac80cf49871df94586850c9b5f1367eaf2f7c324e6ba130b7a6
|
7
|
+
data.tar.gz: 676449173b46273ffa10fd6839cc4514b8aedefcb9c7bd5b363268fd8ecf5fea552f67294ed6ab59327563f3ae59bb9d19b9066d53c9b677dab9317e83c4da4e
|
data/Changelog.md
CHANGED
@@ -12,7 +12,7 @@ module TireAsyncIndex
|
|
12
12
|
# id - Document id
|
13
13
|
#
|
14
14
|
def perform(action_type, class_name, id)
|
15
|
-
klass =
|
15
|
+
klass = find_class_const(class_name)
|
16
16
|
|
17
17
|
case action_type.to_sym
|
18
18
|
when :update
|
@@ -28,6 +28,16 @@ module TireAsyncIndex
|
|
28
28
|
end
|
29
29
|
end
|
30
30
|
end
|
31
|
+
|
32
|
+
def find_class_const(class_name)
|
33
|
+
if defined?(RUBY_VERSION) && RUBY_VERSION.match(/^2\./)
|
34
|
+
Kernel.const_get(class_name)
|
35
|
+
else
|
36
|
+
class_name.split('::').reduce(Object) do |mod, const_name|
|
37
|
+
mod.const_get(const_name)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
31
41
|
end
|
32
42
|
end
|
33
43
|
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
require 'tire'
|
3
|
+
require 'sidekiq'
|
4
|
+
require 'resque'
|
5
|
+
require 'tire_async_index'
|
6
|
+
|
7
|
+
module Level1
|
8
|
+
module Level2
|
9
|
+
class Model
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
describe TireAsyncIndex::Workers::UpdateIndex do
|
15
|
+
|
16
|
+
describe '#perform' do
|
17
|
+
let(:instance) { described_class.new }
|
18
|
+
|
19
|
+
it 'resolves class constant' do
|
20
|
+
expect {
|
21
|
+
instance.perform(:nothing, 'Level1::Level2::Model', 123)
|
22
|
+
}.not_to raise_error
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tire_async_index
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sergey Efremov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-07-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: tire
|
@@ -149,6 +149,7 @@ files:
|
|
149
149
|
- spec/active_record_tire_async_index_spec.rb
|
150
150
|
- spec/test_helper.rb
|
151
151
|
- spec/test_schema.rb
|
152
|
+
- spec/update_index_spec.rb
|
152
153
|
- tire_async_index.gemspec
|
153
154
|
homepage: http://github.com/EvilFaeton/tire_async_index
|
154
155
|
licenses:
|
@@ -179,3 +180,4 @@ test_files:
|
|
179
180
|
- spec/active_record_tire_async_index_spec.rb
|
180
181
|
- spec/test_helper.rb
|
181
182
|
- spec/test_schema.rb
|
183
|
+
- spec/update_index_spec.rb
|