Class: ActiveShard::ShardLookupHandler
- Inherits:
-
Object
- Object
- ActiveShard::ShardLookupHandler
- Defined in:
- lib/active_shard/shard_lookup_handler.rb
Overview
Handles current shard resolution using the provided scope
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ ShardLookupHandler
constructor
Initializes a shard lookup handler.
-
#lookup_active_shard(schema_name) ⇒ Symbol?
Returns the active shard for the provided schema, or nil if none.
Constructor Details
#initialize(options = {}) ⇒ ShardLookupHandler
Initializes a shard lookup handler
12 13 14 |
# File 'lib/active_shard/shard_lookup_handler.rb', line 12 def initialize( ={} ) @scope = [:scope] end |
Instance Method Details
#lookup_active_shard(schema_name) ⇒ Symbol?
Returns the active shard for the provided schema, or nil if none.
21 22 23 |
# File 'lib/active_shard/shard_lookup_handler.rb', line 21 def lookup_active_shard( schema_name ) @scope.active_shard_for_schema( schema_name ) end |