Sha256: 509d3aab036279001623229567b2e1a63efad550e5919b0f6aa2fe2a7e5cb0df

Contents?: true

Size: 719 Bytes

Versions: 3

Compression:

Stored size: 719 Bytes

Contents

require "alephant/sequencer/version"
require "alephant/sequencer/sequencer"
require "alephant/sequencer/sequence_table"
require "alephant/sequencer/sequence_cache"

module Alephant
  module Sequencer
    @@sequence_tables = {}

    def self.create(table_name, opts = {})
      defaults = {
        :jsonpath => nil,
        :keep_all => true,
        :config => {}
      }

      opts = defaults.merge(opts).tap do |opts|
        opts[:cache] = self.cache(opts[:config])
      end

      @@sequence_tables[table_name] ||= SequenceTable.new(table_name)
      Sequencer.new(@@sequence_tables[table_name], opts)
    end

    private

    def self.cache(config)
      @cache ||= SequenceCache.new(config)
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
alephant-sequencer-3.0.2 lib/alephant/sequencer.rb
alephant-sequencer-3.0.1 lib/alephant/sequencer.rb
alephant-sequencer-3.0.0 lib/alephant/sequencer.rb