class Plugin
Public Class Methods
inherited(plgn)
click to toggle source
Registers the current plugin with the system.
Returns nothing.
Calls superclass method
# File lib/twke/plugin.rb, line 35 def inherited(plgn) Plugin.plugins << plgn Twke.plugin(plgn) super end
load_plugin()
click to toggle source
Invoked to load this plugin. Will initialize and add to the loaded plugins list. TODO: Add initialization parameters here??
# File lib/twke/plugin.rb, line 28 def load_plugin Plugin.loaded_plugins << new() end
loaded_plugins()
click to toggle source
# File lib/twke/plugin.rb, line 21 def loaded_plugins @loaded_plugins ||= [] end
plugin_name()
click to toggle source
Returns a short name for the plugin
# File lib/twke/plugin.rb, line 6 def plugin_name @plugin_name ||= begin str = name.dup str.downcase! str.sub! /.*:/, '' str end end
plugins()
click to toggle source
Track all the available plugins
# File lib/twke/plugin.rb, line 17 def plugins @plugins ||= [] end
Public Instance Methods
event(name, rp, opts)
click to toggle source
Invoked to send an event to this plugin. Checks if plugins responds to the event. All events take a routing prefix and the CLI options.
# File lib/twke/plugin.rb, line 46 def event(name, rp, opts) if self.respond_to?(name.to_sym) self.send(name.to_sym, rp, opts) end end