Sha256: babb6c5904e75e908a5210965c912597282c413b028ad15f20d544de80cafc3e
Contents?: true
Size: 1.16 KB
Versions: 3
Compression:
Stored size: 1.16 KB
Contents
require 'alephant/lookup/lookup_table' require 'alephant/lookup/lookup_query' require 'alephant/lookup/location_read' require 'alephant/lookup/location_write' module Alephant module Lookup class LookupHelper attr_reader :component_id def initialize(lookup_table, component_id = nil) @lookup_table = lookup_table @component_id = component_id create_lookup_table end def read(opts, ident = nil) ident = @component_id || ident reader = LocationRead.new(@lookup_table) reader.read(LookupQuery.new(ident, opts)).location end def write(opts, location, ident = nil) ident = @component_id || ident batch_write(opts, location, ident) batch_process end def batch_write(opts, location, ident = nil) ident = @component_id || ident @batch_write ||= LocationWrite.new(@lookup_table) @batch_write << LookupQuery.new(ident, opts, location) end def batch_process @batch_write.process! @batch_write = nil end private def create_lookup_table @lookup_table.create end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
alephant-lookup-0.1.2 | lib/alephant/lookup/lookup_helper.rb |
alephant-lookup-0.1.1 | lib/alephant/lookup/lookup_helper.rb |
alephant-lookup-0.1.0 | lib/alephant/lookup/lookup_helper.rb |