class Rollbar::Plugins
Stores the available plugin definitions and loads them
Attributes
collection[R]
Public Class Methods
new()
click to toggle source
# File lib/rollbar/plugins.rb, line 8 def initialize @collection = [] end
Public Instance Methods
define(name, &block)
click to toggle source
# File lib/rollbar/plugins.rb, line 22 def define(name, &block) return if loaded?(name) plugin = Rollbar::Plugin.new(name) collection << plugin plugin.instance_eval(&block) end
get(name)
click to toggle source
# File lib/rollbar/plugins.rb, line 37 def get(name) collection.find { |plugin| plugin.name == name } end
load!()
click to toggle source
# File lib/rollbar/plugins.rb, line 31 def load! collection.each do |plugin| plugin.load! unless plugin.on_demand end end
plugin_files()
click to toggle source
# File lib/rollbar/plugins.rb, line 18 def plugin_files File.expand_path('../plugins/*.rb', __FILE__) end
require_all()
click to toggle source
# File lib/rollbar/plugins.rb, line 12 def require_all Dir.glob(plugin_files).each do |file| require file.to_s end end
Private Instance Methods
loaded?(name)
click to toggle source
# File lib/rollbar/plugins.rb, line 43 def loaded?(name) collection.any? { |plugin| plugin.name == name } end