Class: Cinch::PluginList

Inherits:
Array
  • Object
show all
Defined in:
lib/cinch/plugin_list.rb

Overview

Since:

  • 2.0.0

Instance Method Summary collapse

Constructor Details

#initialize(bot) ⇒ PluginList

Returns a new instance of PluginList

Since:

  • 2.0.0


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

Since:

  • 2.0.0


10
11
12
# File 'lib/cinch/plugin_list.rb', line 10

def register_plugin(plugin)
  self << plugin.new(@bot)
end

#register_plugins(plugins) ⇒ Object

Since:

  • 2.0.0


15
16
17
# File 'lib/cinch/plugin_list.rb', line 15

def register_plugins(plugins)
  plugins.each { |plugin| register_plugin(plugin) }
end

#unregister_allObject

Since:

  • 2.0.0


34
35
36
# File 'lib/cinch/plugin_list.rb', line 34

def unregister_all
  unregister_plugins(self)
end

#unregister_plugin(plugin) ⇒ Object

Since:

  • 2.0.0


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

Since:

  • 2.0.0


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