lib/zabbix-ruby-client/plugins.rb in zabbix-ruby-client-0.0.15 vs lib/zabbix-ruby-client/plugins.rb in zabbix-ruby-client-0.0.16

- old
+ new

@@ -1,10 +1,10 @@ -class ZabbixRubyClient +module ZabbixRubyClient module Plugins extend self - def load_dirs(dirs) + 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") @@ -12,18 +12,18 @@ a } end end - def register(plugin, klass) - @loaded[plugin] = klass - end - def loaded @loaded ||= {} end + def register(plugin, klass) + @loaded[plugin] = klass + end + def load(plugin) if @loaded[plugin] true else if @available[plugin] @@ -32,7 +32,12 @@ nil end end end + def reset + @loaded = {} + @available = {} + end + end -end \ No newline at end of file +end