Sha256: fd2a01787f52b61a027b2a7d0596677668e217f5db1552dc1fd5f0a004daa46c

Contents?: true

Size: 556 Bytes

Versions: 3

Compression:

Stored size: 556 Bytes

Contents

module ActiveRecord::Turntable
  class Sequencer
    class Barrage < Sequencer
      @@unique_barrage_instance = {}

      def initialize(klass, options = {})
        require "barrage"
        @klass = klass
        @options = options["options"]
      end

      def next_sequence_value(sequence_name)
        barrage.next
      end

      def current_sequence_value(sequence_name)
        barrage.current
      end

      private

        def barrage
          @@unique_barrage_instance[@options] ||= ::Barrage.new(@options)
        end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
activerecord-turntable-3.0.0.alpha3 lib/active_record/turntable/sequencer/barrage.rb
activerecord-turntable-3.0.0.alpha2 lib/active_record/turntable/sequencer/barrage.rb
activerecord-turntable-3.0.0.alpha1 lib/active_record/turntable/sequencer/barrage.rb