alephant-lookup 0.0.4 → 0.1.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: ee8710b1105981b02407c5f9cde7eb768add6f7a
4
- data.tar.gz: 7b5e984fcc9df4abd22a6381efedff235ddecd4e
3
+ metadata.gz: ef3ba4169c1f38bd9cb7b77e7232d6b397df859d
4
+ data.tar.gz: 625f0e7bc33ab02f9f7f6c37e2ef66095224edb2
5
5
  SHA512:
6
- metadata.gz: 15bb96737efdd8f21ae30527f200007d542fa9d19771efaf51622498d7bb8319d572b3ce8ed7fd317778dd50839aade495b48ff74a5c5262edba23097e812132
7
- data.tar.gz: 0fa7a64f459bae0ee17cc94a7b2ffd354892b548d3b70ae9db6cc0685c4f9528b66165743038c4b8aeceddc3300c25219fa0809e9d8f12f2b6e503abbaffee62
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(@component_id, opts)).location
20
+ reader.read(LookupQuery.new(ident, opts)).location
20
21
  end
21
22
 
22
- def write(opts, location)
23
- writer = LocationWrite.new(@lookup_table)
24
- writer << LookupQuery.new(@component_id, opts, location)
25
- writer.process!
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(@component_id, opts, location)
32
+ @batch_write << LookupQuery.new(ident, opts, location)
31
33
  end
32
34
 
33
35
  def batch_process
@@ -1,5 +1,5 @@
1
1
  module Alephant
2
2
  module Lookup
3
- VERSION = "0.0.4"
3
+ VERSION = "0.1.0"
4
4
  end
5
5
  end
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
- instance = subject.new(lookup_table.new, pal_opts[:id])
106
- write_return = instance.write(pal_opts, :s3_location)
107
-
108
- expect(write_return).to eq(true)
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: alephant-lookup
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Robert Kenny