Class: FastExists::MultiTenant::Allocator
- Inherits:
-
Object
- Object
- FastExists::MultiTenant::Allocator
- Defined in:
- lib/fast_exists/multi_tenant/allocator.rb
Instance Attribute Summary collapse
-
#strategy ⇒ Object
readonly
Returns the value of attribute strategy.
Instance Method Summary collapse
- #add(tenant_id, attribute, value) ⇒ Object
- #contains?(tenant_id, attribute, value) ⇒ Boolean
-
#initialize(strategy_type = FastExists.configuration.tenant_strategy, options = {}) ⇒ Allocator
constructor
A new instance of Allocator.
- #stats ⇒ Object
Constructor Details
#initialize(strategy_type = FastExists.configuration.tenant_strategy, options = {}) ⇒ Allocator
Returns a new instance of Allocator.
8 9 10 11 |
# File 'lib/fast_exists/multi_tenant/allocator.rb', line 8 def initialize(strategy_type = FastExists.configuration.tenant_strategy, = {}) @strategy_type = strategy_type.to_sym @strategy = build_strategy(@strategy_type, ) end |
Instance Attribute Details
#strategy ⇒ Object (readonly)
Returns the value of attribute strategy.
6 7 8 |
# File 'lib/fast_exists/multi_tenant/allocator.rb', line 6 def strategy @strategy end |
Instance Method Details
#add(tenant_id, attribute, value) ⇒ Object
13 14 15 |
# File 'lib/fast_exists/multi_tenant/allocator.rb', line 13 def add(tenant_id, attribute, value) @strategy.add(tenant_id, attribute, value) end |
#contains?(tenant_id, attribute, value) ⇒ Boolean
17 18 19 |
# File 'lib/fast_exists/multi_tenant/allocator.rb', line 17 def contains?(tenant_id, attribute, value) @strategy.contains?(tenant_id, attribute, value) end |
#stats ⇒ Object
21 22 23 |
# File 'lib/fast_exists/multi_tenant/allocator.rb', line 21 def stats @strategy.stats.merge(strategy_type: @strategy_type) end |