Class: ActiveShard::Config
- Inherits:
-
Object
- Object
- ActiveShard::Config
- Defined in:
- lib/active_shard/config.rb
Instance Method Summary collapse
- #add_shard(environment, shard_definition) ⇒ Object
- #remove_shard(environment, shard_name) ⇒ Object
- #schemas(environment) ⇒ Object
- #shard(environment, shard_name) ⇒ Object
- #shard_configuration=(configuration) ⇒ Object
- #shard_definitions(environment) ⇒ Object
- #shards_by_schema(environment, schema) ⇒ Object
Instance Method Details
#add_shard(environment, shard_definition) ⇒ Object
23 24 25 |
# File 'lib/active_shard/config.rb', line 23 def add_shard( environment, shard_definition ) shard_collection( environment ).add_shard( shard_definition ) end |
#remove_shard(environment, shard_name) ⇒ Object
31 32 33 |
# File 'lib/active_shard/config.rb', line 31 def remove_shard( environment, shard_name ) shard_collection( environment ).remove_shard( shard_name ) end |
#schemas(environment) ⇒ Object
19 20 21 |
# File 'lib/active_shard/config.rb', line 19 def schemas( environment ) shard_collection( environment ).schemas end |
#shard(environment, shard_name) ⇒ Object
35 36 37 |
# File 'lib/active_shard/config.rb', line 35 def shard( environment, shard_name ) shard_collection( environment ).shard( shard_name ) end |
#shard_configuration=(configuration) ⇒ Object
7 8 9 10 11 12 13 |
# File 'lib/active_shard/config.rb', line 7 def shard_configuration=( configuration ) shard_collections.clear configuration.each_pair do |environment, shard_definitions| shard_collection( environment.to_sym ).add_shards( shard_definitions ) end end |
#shard_definitions(environment) ⇒ Object
27 28 29 |
# File 'lib/active_shard/config.rb', line 27 def shard_definitions( environment ) shard_collection( environment ) end |
#shards_by_schema(environment, schema) ⇒ Object
15 16 17 |
# File 'lib/active_shard/config.rb', line 15 def shards_by_schema( environment, schema ) shard_collection( environment ).by_schema( schema ) end |