summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/oxidized/input/input.rb5
-rw-r--r--lib/oxidized/manager.rb14
-rw-r--r--lib/oxidized/model/model.rb1
-rw-r--r--lib/oxidized/output/output.rb5
-rw-r--r--lib/oxidized/source/source.rb5
5 files changed, 9 insertions, 21 deletions
diff --git a/lib/oxidized/input/input.rb b/lib/oxidized/input/input.rb
index 769b196..1184a0b 100644
--- a/lib/oxidized/input/input.rb
+++ b/lib/oxidized/input/input.rb
@@ -14,10 +14,5 @@ module Oxidized
Errno::EPIPE,
],
}
- class << self
- def inherited klass
- Oxidized.mgr.loader = { :class => klass }
- end
- end
end
end
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 = {}
diff --git a/lib/oxidized/model/model.rb b/lib/oxidized/model/model.rb
index 6f4f54d..c3d8760 100644
--- a/lib/oxidized/model/model.rb
+++ b/lib/oxidized/model/model.rb
@@ -9,7 +9,6 @@ module Oxidized
klass.instance_variable_set '@procs', Hash.new { |h,k| h[k] = [] }
klass.instance_variable_set '@expect', []
klass.const_set :CFG, CFG
- Oxidized.mgr.loader = { :class => klass }
end
def comment _comment='# '
return @comment if @comment
diff --git a/lib/oxidized/output/output.rb b/lib/oxidized/output/output.rb
index 54d616c..eaf149a 100644
--- a/lib/oxidized/output/output.rb
+++ b/lib/oxidized/output/output.rb
@@ -1,10 +1,5 @@
module Oxidized
class Output
class NoConfig < OxidizedError; end
- class << self
- def inherited klass
- Oxidized.mgr.loader = { :class => klass }
- end
- end
end
end
diff --git a/lib/oxidized/source/source.rb b/lib/oxidized/source/source.rb
index 5093950..3c1f255 100644
--- a/lib/oxidized/source/source.rb
+++ b/lib/oxidized/source/source.rb
@@ -1,11 +1,6 @@
module Oxidized
class Source
class NoConfig < OxidizedError; end
- class << self
- def inherited klass
- Oxidized.mgr.loader = { :class => klass }
- end
- end
def initialize
@map = (CFG.model_map or {})
end