| Class | Hobix::BasePlugin |
| In: |
lib/hobix/base.rb
|
| Parent: | Object |
The BasePlugin class is bingo the underlying class for all Hobix plugins. The +Class::inherited+ hook is used by this class to keep track of all classes that inherit from it.
# File lib/hobix/base.rb, line 56
56: def BasePlugin.inherited( sub )
57: @@plugins[@@required_from] ||= []
58: @@plugins[@@required_from] << sub
59: end
Initializes all the plugins, returning an Array of plugin objects. (Used by the +Hobix::Weblog+ class.)
# File lib/hobix/base.rb, line 36
36: def BasePlugin.start( req, opts, weblog )
37: @@required_from = req = req.dup
38: if req.tainted?
39: req.untaint if req =~ /^[\w\/\\]+$/
40: end
41: require( req )
42: @@required_from = nil
43:
44: if @@plugins[req]
45: @@plugins[req].collect do |p|
46: if opts
47: p.new( weblog, opts )
48: else
49: p.new( weblog )
50: end
51: end
52: else
53: []
54: end
55: end