alephant-lookup 0.0.4 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/alephant/lookup/lookup_helper.rb +11 -9
- data/lib/alephant/lookup/version.rb +1 -1
- data/spec/lookup_spec.rb +4 -4
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ef3ba4169c1f38bd9cb7b77e7232d6b397df859d
|
4
|
+
data.tar.gz: 625f0e7bc33ab02f9f7f6c37e2ef66095224edb2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9e38028f8348ebeda01dcf0467bdc0ba510f813c5b0367106e1f65804a2c4f09fe4c4d62e9547fd4a023af25f2d2a7275e4b4b2a927c6d650d68fd4b285f20c0
|
7
|
+
data.tar.gz: d863bb7b732d3f8a3201b585c9ba88d5517b95e6276e9eee043d0f841e8991e3bc0a1cefe53b2ad653cbfafd3ab8cad36a3fc154e9813cc34327f2fa092ef02b
|
@@ -8,26 +8,28 @@ module Alephant
|
|
8
8
|
class LookupHelper
|
9
9
|
attr_reader :component_id
|
10
10
|
|
11
|
-
def initialize(lookup_table, component_id)
|
11
|
+
def initialize(lookup_table, component_id = nil)
|
12
12
|
@lookup_table = lookup_table
|
13
13
|
@component_id = component_id
|
14
14
|
create_lookup_table
|
15
15
|
end
|
16
16
|
|
17
|
-
def read(opts)
|
17
|
+
def read(opts, ident = nil)
|
18
|
+
ident = @component_id || ident
|
18
19
|
reader = LocationRead.new(@lookup_table)
|
19
|
-
reader.read(LookupQuery.new(
|
20
|
+
reader.read(LookupQuery.new(ident, opts)).location
|
20
21
|
end
|
21
22
|
|
22
|
-
def write(opts, location)
|
23
|
-
|
24
|
-
|
25
|
-
|
23
|
+
def write(opts, location, ident = nil)
|
24
|
+
ident = @component_id || ident
|
25
|
+
batch_write(opts, location, ident)
|
26
|
+
batch_process
|
26
27
|
end
|
27
28
|
|
28
|
-
def batch_write(opts, location)
|
29
|
+
def batch_write(opts, location, ident = nil)
|
30
|
+
ident = @component_id || ident
|
29
31
|
@batch_write ||= LocationWrite.new(@lookup_table)
|
30
|
-
@batch_write << LookupQuery.new(
|
32
|
+
@batch_write << LookupQuery.new(ident, opts, location)
|
31
33
|
end
|
32
34
|
|
33
35
|
def batch_process
|
data/spec/lookup_spec.rb
CHANGED
@@ -102,10 +102,10 @@ describe Alephant::Lookup do
|
|
102
102
|
.any_instance
|
103
103
|
.should_receive(:process!)
|
104
104
|
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
105
|
+
subject.new(
|
106
|
+
lookup_table.new,
|
107
|
+
pal_opts[:id]
|
108
|
+
).write(pal_opts, :s3_location)
|
109
109
|
end
|
110
110
|
end
|
111
111
|
end
|