Sha256: 613d27ee9ed51f9abaa35adc9d30431776c20b670afc3e6a53b3a585ed8a4d3e

Contents?: true

Size: 707 Bytes

Versions: 4

Compression:

Stored size: 707 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] = 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

4 entries across 4 versions & 1 rubygems

Version Path
alephant-sequencer-3.2.0 lib/alephant/sequencer.rb
alephant-sequencer-3.1.1 lib/alephant/sequencer.rb
alephant-sequencer-3.1.0 lib/alephant/sequencer.rb
alephant-sequencer-3.0.3 lib/alephant/sequencer.rb