Class: Alerty::PluginFactory

Inherits:
Object
  • Object
show all
Defined in:
lib/alerty/plugin_factory.rb

Class Method Summary collapse

Class Method Details

.new_plugin(config) ⇒ Object



8
9
10
11
12
# File 'lib/alerty/plugin_factory.rb', line 8

def new_plugin(config)
  require "alerty/plugin/#{config.type}"
  class_name = "Alerty::Plugin::#{StringUtil.camelize(config.type)}"
  Object.const_get(class_name).new(config)
end

.pluginsObject



4
5
6
# File 'lib/alerty/plugin_factory.rb', line 4

def plugins
  @plugins ||= Config.plugins.map {|config| new_plugin(config) }
end