Class: Crosstest::Psychic::TaskFactoryManager

Inherits:
FactoryManager show all
Defined in:
lib/crosstest/psychic/task_factory_manager.rb

Constant Summary

Constants inherited from FactoryManager

FactoryManager::BUILT_IN_DIR

Instance Attribute Summary

Attributes inherited from FactoryManager

#factories

Instance Method Summary collapse

Methods inherited from FactoryManager

#active?, #active_factories, autoload_factories!, clear, factory_classes, #initialize, register_factory

Constructor Details

This class inherits a constructor from Crosstest::Psychic::FactoryManager

Instance Method Details

#factories_for(task) ⇒ Object


4
5
6
7
8
9
10
11
12
# File 'lib/crosstest/psychic/task_factory_manager.rb', line 4

def factories_for(task)
  capable_factories = active_factories.select do | factory |
    factory.priority_for_task(task)
  end

  capable_factories.sort_by do |factory|
    factory.priority_for_task(task)
  end
end

#known_tasksObject


14
15
16
# File 'lib/crosstest/psychic/task_factory_manager.rb', line 14

def known_tasks
  active_factories.flat_map(&:known_tasks)
end