class ActiveRecord::Sharding::ClusterConfig
Attributes
name[R]
Public Class Methods
new(name)
click to toggle source
# File lib/active_record/sharding/cluster_config.rb, line 6 def initialize(name) @name = name @connection_registry = [] end
Public Instance Methods
connections()
click to toggle source
# File lib/active_record/sharding/cluster_config.rb, line 27 def connections @connection_registry end
fetch(modulo_key)
click to toggle source
# File lib/active_record/sharding/cluster_config.rb, line 15 def fetch(modulo_key) @connection_registry[modulo_key] end
register_connection(connection_name)
click to toggle source
# File lib/active_record/sharding/cluster_config.rb, line 11 def register_connection(connection_name) @connection_registry << connection_name end
registered_connection_count()
click to toggle source
# File lib/active_record/sharding/cluster_config.rb, line 19 def registered_connection_count @connection_registry.count end
validate_config!()
click to toggle source
# File lib/active_record/sharding/cluster_config.rb, line 23 def validate_config! raise "Nothing registered connections." if registered_connection_count == 0 end