Sha256: 227be5eade493b692cfd0dac3b9a8cf95458a1a70e6caa47fc7cad6c8eda5afe
Contents?: true
Size: 893 Bytes
Versions: 11
Compression:
Stored size: 893 Bytes
Contents
module DbCharmer module Sharding class Connection attr_accessor :config, :sharder def initialize(config) @config = config @sharder = self.instantiate_sharder end def instantiate_sharder raise ArgumentError, "No :method passed!" unless config[:method] sharder_class_name = "DbCharmer::Sharding::Method::#{config[:method].to_s.classify}" sharder_class = sharder_class_name.constantize sharder_class.new(config) end def shard_connections sharder.respond_to?(:shard_connections) ? sharder.shard_connections : nil end def support_default_shard? sharder.respond_to?(:support_default_shard?) && sharder.support_default_shard? end def default_connection @default_connection ||= DbCharmer::Sharding::StubConnection.new(self) end end end end
Version data entries
11 entries across 11 versions & 1 rubygems