Sha256: 3b79aeca090e0bb9dc15cb9a1110e9db5fcfe37fbdbb99d5884bd3a89781c699
Contents?: true
Size: 750 Bytes
Versions: 11
Compression:
Stored size: 750 Bytes
Contents
require "zabbix-ruby-client" module ZabbixRubyClient module Plugins extend self def scan_dirs(dirs) @available = {} @loaded = {} dirs.each do |d| Dir.glob(File.join(d,"*.rb")).reduce(@available) { |a,x| name = File.basename(x,".rb") a[name] = x a } end end def loaded @loaded ||= {} end def register(plugin, klass) @loaded[plugin] = klass end def load(plugin) if @loaded[plugin] true else if @available[plugin] ZabbixRubyClient.send :load, @available[plugin] else nil end end end def reset @loaded = {} @available = {} end end end
Version data entries
11 entries across 11 versions & 1 rubygems