CodeRay::Plugin

Plugin

 Plugins have to include this module.

 IMPORTANT: Use extend for this module.

 See CodeRay::PluginHost for examples.

Attributes

plugin_id[R]

Public Instance Methods

aliases() click to toggle source
     # File lib/coderay/helpers/plugin.rb, line 274
274:     def aliases
275:       plugin_host.load_plugin_map
276:       plugin_host.plugin_hash.inject [] do |aliases, (key, _)|
277:         aliases << key if plugin_host[key] == self
278:         aliases
279:       end
280:     end
plugin_host(host = nil) click to toggle source

The PluginHost for this Plugin class.

     # File lib/coderay/helpers/plugin.rb, line 267
267:     def plugin_host host = nil
268:       if host.is_a? PluginHost
269:         const_set :PLUGIN_HOST, host
270:       end
271:       self::PLUGIN_HOST
272:     end
register_for(id) click to toggle source

Register this class for the given id.

Example:

  class MyPlugin < PluginHost::BaseClass
    register_for :my_id
    ...
  end

See PluginHost.register.

     # File lib/coderay/helpers/plugin.rb, line 251
251:     def register_for id
252:       @plugin_id = id
253:       plugin_host.register self, id
254:     end
title(title = nil) click to toggle source

Returns the title of the plugin, or sets it to the optional argument title.

     # File lib/coderay/helpers/plugin.rb, line 258
258:     def title title = nil
259:       if title
260:         @title = title.to_s
261:       else
262:         @title ||= name[/([^:]+)$/, 1]
263:       end
264:     end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.