Class: Pluginator::Group
- Inherits:
-
Object
- Object
- Pluginator::Group
- Defined in:
- lib/pluginator/group.rb
Overview
Initial data for pluginator, includes group name and plugins
Direct Known Subclasses
Instance Attribute Summary collapse
-
#group ⇒ Object
readonly
Group name used for plugins.
Instance Method Summary collapse
-
#[](type) ⇒ Array
List of plugins for type.
-
#initialize(group) ⇒ Group
constructor
sets up new instance and initial configuration.
-
#register_plugin(type, klass) ⇒ Object
Register a new plugin, can be used to load custom plugins.
-
#types ⇒ Array
List of plugin types loaded.
Constructor Details
#initialize(group) ⇒ Group
sets up new instance and initial configuration
28 29 30 |
# File 'lib/pluginator/group.rb', line 28 def initialize(group) setup_group(group) end |
Instance Attribute Details
#group ⇒ Object (readonly)
Group name used for plugins
24 25 26 |
# File 'lib/pluginator/group.rb', line 24 def group @group end |
Instance Method Details
#[](type) ⇒ Array
Returns list of plugins for type.
34 35 36 |
# File 'lib/pluginator/group.rb', line 34 def [](type) @plugins[type.to_s] end |
#register_plugin(type, klass) ⇒ Object
Register a new plugin, can be used to load custom plugins
47 48 49 50 51 |
# 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 ⇒ Array
Returns list of plugin types loaded.
39 40 41 |
# File 'lib/pluginator/group.rb', line 39 def types @plugins.keys end |