Sha256: 067bd2b24baa2702f74da2e0b3664d444c830e8879a04df3131dce809e18ef31

Contents?: true

Size: 714 Bytes

Versions: 1

Compression:

Stored size: 714 Bytes

Contents

require 'active_record'
require 'slavery/version'
require 'slavery/base'
require 'slavery/error'
require 'slavery/connection_holder'
require 'slavery/transaction'
require 'slavery/active_record/base'
require 'slavery/active_record/connection_handling'
require 'slavery/active_record/relation'
require 'slavery/active_record/log_subscriber'

module Slavery
  class << self
    attr_accessor :disabled

    def slave_connections
      @slave_connections ||= {}
    end

    def on_slave(name = :null_state, &block)
      raise Slavery::Error.new('invalid slave target') unless name.is_a?(Symbol)
      Base.new(name).run &block
    end

    def on_master(&block)
      Base.new(:master).run &block
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
slavery-3.0.0 lib/slavery.rb