Version 1.0.6 of pluginfactory has been released.
PluginFactory is a mixin for adding plugin classes to your application.
It adds a ‘create’ method to your base plugin class that can be used to
search for/and load them later.
For example, if you want pluggable ‘driver’ classes for your library,
you can define the base class like so:
# Set one or more paths to use when searching for # 'Driver' plugins def self::derivative_dirs ["drivers"] end
Now, if someone wants to provide their own plugin, they just inherit
from ‘Driver’ like so:
class SpecialDriver < Driver
# …do special driver-ish things
saves it as `drivers/special.rb’ (or one of several other variants) in
their library, and then load it by name via the superclass:
special = Driver.create( ‘special’ )
PluginFactory will search for the correct require, require your library,
and create a new instance of the appropriate subclass. Any additional
arguments to ‘create’ will be passed to the subclass’s constructor.
== Project Page
$ sudo gem install pluginfactory
or from source:
$ wget http://deveiate.org/code/pluginfactory-1.0.6.tar.gz
$ tar -xzvf pluginfactory-1.0.6.tar.gz
$ cd pluginfactory-1.0.6
$ sudo rake install
Repackaging for newer Rubygems. This release contains no major code