Method: AutomateIt::Plugin::Manager#instantiate_drivers

Defined in:
lib/automateit/plugin/manager.rb

#instantiate_driversObject

Instantiate drivers for this manager. This method is smart enough that it can be called multiple times and will only instantiate drivers it hasn’t instantiated yet. All drivers will share an instance of the Interpreter, thus providing common state storage.



73
74
75
76
77
78
79
80
81
82
83
84
85
86
# File 'lib/automateit/plugin/manager.rb', line 73

def instantiate_drivers
  @drivers ||= {}
  self.class.driver_classes.each do |driver_class|
    driver_token = driver_class.token
    unless @drivers[driver_token]
      @drivers[driver_token] = driver_class.allocate
    end
  end
  self.class.driver_classes.each do |driver_class|
    driver_token = driver_class.token
    @drivers[driver_token].setup(
      :interpreter => @interpreter, :manager => self)
  end
end