Module CodeRay::Plugin
In: lib/coderay/helpers/plugin.rb

Plugin

 Plugins have to include this module.

 IMPORTANT: Use extend for this module.

 See CodeRay::PluginHost for examples.

Methods

Attributes

plugin_id  [R] 

Public Instance methods

[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

The PluginHost for this Plugin class.

[Source]

     # 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 this class for the given id.

Example:

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

See PluginHost.register.

[Source]

     # 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

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

[Source]

     # 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

[Validate]