class Pluginator::Group
Initial data for pluginator, includes group name and plugins
Attributes
group[R]
Group
name used for plugins
Public Class Methods
new(group)
click to toggle source
sets up new instance and initial configuration @param group [String] name of the plugins group
# File lib/pluginator/group.rb, line 28 def initialize(group) setup_group(group) end
Public Instance Methods
[](type)
click to toggle source
@param [String] type of plugins to select @return [Array] list of plugins for type
# File lib/pluginator/group.rb, line 34 def [](type) @plugins[type.to_s] end
register_plugin(type, klass)
click to toggle source
Register a new plugin, can be used to load custom plugins
@param type [String] type for the klass @param klass [Class] klass of the plugin to add
# File lib/pluginator/group.rb, line 47 def register_plugin(type, klass) type = type.to_s @plugins[type] ||= [] @plugins[type].push(klass) unless @plugins[type].include?(klass) end
types()
click to toggle source
@return [Array] list of plugin types loaded
# File lib/pluginator/group.rb, line 39 def types @plugins.keys end
Private Instance Methods
setup_group(group)
click to toggle source
# File lib/pluginator/group.rb, line 55 def setup_group(group) @plugins = {} @group = group end