Sha256: 02994321294d3db58f0918c3a63f37e0f5d2ff51b7d5170c9998733a9596560c
Contents?: true
Size: 769 Bytes
Versions: 17
Compression:
Stored size: 769 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 end end end
Version data entries
17 entries across 17 versions & 1 rubygems