Class: Hobix::BasePlugin

Inherits:
Object
  • Object
show all
Defined in:
lib/hobix/base.rb

Overview

from it.

Constant Summary collapse

@@plugins =
{}
@@required_from =
nil

Class Method Summary collapse

Class Method Details

.inherited(sub) ⇒ Object



56
57
58
59
# File 'lib/hobix/base.rb', line 56

def BasePlugin.inherited( sub )
    @@plugins[@@required_from] ||= []
    @@plugins[@@required_from] << sub
end

.start(req, opts, weblog) ⇒ Object

Initializes all the plugins, returning an Array of plugin objects. (Used by the Hobix::Weblog class.)



36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/hobix/base.rb', line 36

def BasePlugin.start( req, opts, weblog )
    @@required_from = req = req.dup
    if req.tainted?
        req.untaint if req =~ /^[\w\/\\]+$/
    end
    require( req )
    @@required_from = nil

    if @@plugins[req]
        @@plugins[req].collect do |p|
            if opts
                p.new( weblog, opts )
            else
                p.new( weblog )
            end
        end
    else
        []
    end
end