Class: Cinch::PluginList
- Inherits:
-
Array
- Object
- Array
- Cinch::PluginList
- Defined in:
- lib/cinch/plugin_list.rb
Overview
Instance Method Summary collapse
-
#initialize(bot) ⇒ PluginList
constructor
A new instance of PluginList.
-
#register_plugin(plugin) ⇒ Object
-
#register_plugins(plugins) ⇒ Object
-
#unregister_all ⇒ Object
-
#unregister_plugin(plugin) ⇒ Object
-
#unregister_plugins(plugins) ⇒ Object
Constructor Details
#initialize(bot) ⇒ PluginList
Returns a new instance of PluginList.
4 5 6 7 |
# File 'lib/cinch/plugin_list.rb', line 4 def initialize(bot) @bot = bot super() end |
Instance Method Details
#register_plugin(plugin) ⇒ Object
10 11 12 |
# File 'lib/cinch/plugin_list.rb', line 10 def register_plugin(plugin) self << plugin.new(@bot) end |
#register_plugins(plugins) ⇒ Object
15 16 17 |
# File 'lib/cinch/plugin_list.rb', line 15 def register_plugins(plugins) plugins.each { |plugin| register_plugin(plugin) } end |
#unregister_all ⇒ Object
34 35 36 |
# File 'lib/cinch/plugin_list.rb', line 34 def unregister_all unregister_plugins(self) end |
#unregister_plugin(plugin) ⇒ Object
20 21 22 23 |
# File 'lib/cinch/plugin_list.rb', line 20 def unregister_plugin(plugin) plugin.unregister delete(plugin) end |
#unregister_plugins(plugins) ⇒ Object
26 27 28 29 30 31 |
# File 'lib/cinch/plugin_list.rb', line 26 def unregister_plugins(plugins) if plugins == self plugins = self.dup end plugins.each { |plugin| unregister_plugin(plugin) } end |