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

Version Path
zabbix-ruby-client-0.0.15 lib/zabbix-ruby-client/plugins.rb
zabbix-ruby-client-0.0.14 lib/zabbix-ruby-client/plugins.rb
zabbix-ruby-client-0.0.13 lib/zabbix-ruby-client/plugins.rb
zabbix-ruby-client-0.0.12 lib/zabbix-ruby-client/plugins.rb
zabbix-ruby-client-0.0.11 lib/zabbix-ruby-client/plugins.rb
zabbix-ruby-client-0.0.10 lib/zabbix-ruby-client/plugins.rb
zabbix-ruby-client-0.0.9 lib/zabbix-ruby-client/plugins.rb
zabbix-ruby-client-0.0.8 lib/zabbix-ruby-client/plugins.rb
zabbix-ruby-client-0.0.7 lib/zabbix-ruby-client/plugins.rb
zabbix-ruby-client-0.0.6 lib/zabbix-ruby-client/plugins.rb
zabbix-ruby-client-0.0.5 lib/zabbix-ruby-client/plugins.rb
zabbix-ruby-client-0.0.4 lib/zabbix-ruby-client/plugins.rb