Sha256: e47937e6a49aa2aeeeee8932a546d423240d7ff57789be248b3a5065abfb3ee8
Contents?: true
Size: 722 Bytes
Versions: 30
Compression:
Stored size: 722 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(&:load!) end private def loaded?(name) collection.any? { |plugin| plugin.name == name } end end end
Version data entries
30 entries across 30 versions & 1 rubygems