module Plumbus::Loader
Public Class Methods
load(path)
click to toggle source
# File lib/plumbus/loader.rb, line 3 def self.load path self.unload_all dsl = LoaderDSL.new(path) #Load ports dsl.ports.each do |_port| direction = _port[:direction] driver = _port[:driver] config_block = _port[:config_block] #Load driver if not already loaded klass = Driver.load driver #Create instance of driver module port = Port.new(driver_module_klass: klass, direction: direction) port.config &config_block port.attach! end end
unload_all()
click to toggle source
# File lib/plumbus/loader.rb, line 23 def self.unload_all Ports.detach_all end