Method: Train.plugin

Defined in:
lib/train/plugins.rb

.plugin(version = 1) ⇒ Transport

Create a new plugin by inheriting from the class returned by this method. Create a versioned plugin by providing the transport layer plugin version to this method. It will then select the correct class to inherit from.

The plugin version determins what methods will be available to your plugin.

Parameters:

  • version (Int) (defaults to: 1)

    1 the plugin version to use

Returns:

  • (Transport)

    the versioned transport base class



31
32
33
34
35
36
37
38
39
# File 'lib/train/plugins.rb', line 31

def self.plugin(version = 1)
  if version != 1
    raise ClientError,
      "Only understand train plugin version 1. You are trying to "\
      "initialize a train plugin #{version}, which is not supported "\
      "in the current release of train."
  end
  ::Train::Plugins::Transport
end