Sha256: 4b50acdb8758d300a07b3390b16a72d20e69282658aea25e8dde5ca56a874c14
Contents?: true
Size: 654 Bytes
Versions: 12
Compression:
Stored size: 654 Bytes
Contents
class ZabbixRubyClient module Plugins extend self def load_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 register(plugin, klass) @loaded[plugin] = klass end def loaded @loaded ||= {} end def load(plugin) if @loaded[plugin] true else if @available[plugin] ZabbixRubyClient.send :load, @available[plugin] else nil end end end end end
Version data entries
12 entries across 12 versions & 1 rubygems