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.
6 7 8 9 |
# File 'lib/cinch/plugin_list.rb', line 6 def initialize(bot) @bot = bot super() end |
Instance Method Details
#register_plugin(plugin) ⇒ Object
12 13 14 |
# File 'lib/cinch/plugin_list.rb', line 12 def register_plugin(plugin) self << plugin.new(@bot) end |
#register_plugins(plugins) ⇒ Object
17 18 19 |
# File 'lib/cinch/plugin_list.rb', line 17 def register_plugins(plugins) plugins.each { |plugin| register_plugin(plugin) } end |
#unregister_all ⇒ Object
36 37 38 |
# File 'lib/cinch/plugin_list.rb', line 36 def unregister_all unregister_plugins(self) end |
#unregister_plugin(plugin) ⇒ Object
22 23 24 25 |
# File 'lib/cinch/plugin_list.rb', line 22 def unregister_plugin(plugin) plugin.unregister delete(plugin) end |
#unregister_plugins(plugins) ⇒ Object
28 29 30 31 32 33 |
# File 'lib/cinch/plugin_list.rb', line 28 def unregister_plugins(plugins) if plugins == self plugins = dup end plugins.each { |plugin| unregister_plugin(plugin) } end |