Sha256: 24370396568dd7ad7fa09be0b956a08312087b84632e10f33de4dff284868196
Contents?: true
Size: 862 Bytes
Versions: 35
Compression:
Stored size: 862 Bytes
Contents
require 'rollbar/plugin' module Rollbar # Stores the available plugin definitions and loads them class Plugins attr_reader :collection def initialize @collection = [] end def require_all Dir.glob(plugin_files).each do |file| require file.to_s end end def plugin_files File.expand_path('../plugins/*.rb', __FILE__) end def define(name, &block) return if loaded?(name) plugin = Rollbar::Plugin.new(name) collection << plugin plugin.instance_eval(&block) end def load! collection.each do |plugin| plugin.load! unless plugin.on_demand end end def get(name) collection.find { |plugin| plugin.name == name } end private def loaded?(name) collection.any? { |plugin| plugin.name == name } end end end
Version data entries
35 entries across 35 versions & 1 rubygems