Method: Train.create

Defined in:
lib/train.rb

.create(name, *args) ⇒ Transport

Create a new transport instance, with the plugin indicated by the given name.

Parameters:

  • name (String)

    of the plugin

  • *args (Array)

    list of arguments for the plugin

Returns:

  • (Transport)

    instance of the new transport or nil



19
20
21
22
# File 'lib/train.rb', line 19

def self.create(name, *args)
  cls = load_transport(name)
  cls.new(*args) unless cls.nil?
end