Class: Rubots::StrategyLoader
- Inherits:
-
Object
- Object
- Rubots::StrategyLoader
- Defined in:
- lib/rubots/strategy_loader.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(name) ⇒ StrategyLoader
constructor
A new instance of StrategyLoader.
- #strategy_class ⇒ Object
Constructor Details
#initialize(name) ⇒ StrategyLoader
Returns a new instance of StrategyLoader.
14 15 16 |
# File 'lib/rubots/strategy_loader.rb', line 14 def initialize(name) @name = name end |
Class Method Details
.default_lineup ⇒ Object
9 10 11 12 |
# File 'lib/rubots/strategy_loader.rb', line 9 def self.default_lineup [ Samples::Rotator, Samples::SittingDuck, Samples::TargetFinder, Samples::Artillery ] end |
.load(params) ⇒ Object
3 4 5 6 7 |
# File 'lib/rubots/strategy_loader.rb', line 3 def self.load(params) return default_lineup unless params.any? params.map { |p| new(p).strategy_class }.flatten end |
Instance Method Details
#strategy_class ⇒ Object
18 19 20 21 22 23 24 25 26 |
# File 'lib/rubots/strategy_loader.rb', line 18 def strategy_class if is_multiple? multiple_classes elsif is_sample? sample_class else class_from_file end end |