Class: TypeBalancer::Strategies::BaseStrategy
- Inherits:
-
Object
- Object
- TypeBalancer::Strategies::BaseStrategy
- Defined in:
- lib/type_balancer/strategies/base_strategy.rb
Overview
Base class for all balancing strategies
Direct Known Subclasses
Instance Method Summary collapse
-
#balance ⇒ Object
Interface method that all strategies must implement.
-
#initialize(items:, type_field:, types: nil, type_order: nil) ⇒ BaseStrategy
constructor
A new instance of BaseStrategy.
Constructor Details
#initialize(items:, type_field:, types: nil, type_order: nil) ⇒ BaseStrategy
Returns a new instance of BaseStrategy.
7 8 9 10 11 12 |
# File 'lib/type_balancer/strategies/base_strategy.rb', line 7 def initialize(items:, type_field:, types: nil, type_order: nil) @items = items @type_field = type_field @types = types @type_order = type_order end |
Instance Method Details
#balance ⇒ Object
Interface method that all strategies must implement
15 16 17 |
# File 'lib/type_balancer/strategies/base_strategy.rb', line 15 def balance raise NotImplementedError, 'Strategies must implement #balance' end |