diff options
Diffstat (limited to 'lib/oxidized/manager.rb')
-rw-r--r-- | lib/oxidized/manager.rb | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/lib/oxidized/manager.rb b/lib/oxidized/manager.rb index 9352eaf..f901a5f 100644 --- a/lib/oxidized/manager.rb +++ b/lib/oxidized/manager.rb @@ -8,17 +8,21 @@ module Oxidized def load dir, file begin require File.join dir, file+'.rb' - obj, Oxidized.mgr.loader = Oxidized.mgr.loader, nil - k = obj[:class].new - k.setup if k.respond_to? :setup - { file => obj[:class] } + klass = nil + [Oxidized, Object].each do |mod| + klass = mod.constants.find { |const| const.to_s.downcase.match file.downcase } + klass = mod.const_get klass if klass + break if klass + end + i = klass.new + i.setup if i.respond_to? :setup + { file => klass } rescue LoadError {} end end end attr_reader :input, :output, :model, :source - attr_accessor :loader def initialize @input = {} @output = {} |