summaryrefslogtreecommitdiff
path: root/lib/oxidized/manager.rb
diff options
context:
space:
mode:
authorNeil Lathwood <neil@lathwood.co.uk>2018-04-27 10:51:39 +0100
committerNeil Lathwood <neil@lathwood.co.uk>2018-04-27 10:51:39 +0100
commit6574f129bca9633d728c178b12e49a2e9be89cdd (patch)
treea2d630fca3156658aea07469b9a5c3fdf00f6846 /lib/oxidized/manager.rb
parentd96cfac1f09ff4055f54ab604358290865d41f62 (diff)
parent34fd5369feee94ab45c5a81d7769b1df717e4c8c (diff)
Rebased from master
Diffstat (limited to 'lib/oxidized/manager.rb')
-rw-r--r--lib/oxidized/manager.rb13
1 files changed, 9 insertions, 4 deletions
diff --git a/lib/oxidized/manager.rb b/lib/oxidized/manager.rb
index bf28ae7..c4523f3 100644
--- a/lib/oxidized/manager.rb
+++ b/lib/oxidized/manager.rb
@@ -7,11 +7,11 @@ module Oxidized
class << self
def load dir, file
begin
- require File.join dir, file+'.rb'
+ require File.join dir, file + '.rb'
klass = nil
[Oxidized, Object].each do |mod|
klass = mod.constants.find { |const| const.to_s.downcase == file.downcase }
- klass = mod.constants.find { |const| const.to_s.downcase == 'oxidized'+ file.downcase } unless klass
+ klass = mod.constants.find { |const| const.to_s.downcase == 'oxidized' + file.downcase } unless klass
klass = mod.const_get klass if klass
break if klass
end
@@ -31,16 +31,19 @@ module Oxidized
@source = {}
@hook = {}
end
+
def add_input method
method = Manager.load Config::InputDir, method
return false if method.empty?
@input.merge! method
end
+
def add_output method
method = Manager.load Config::OutputDir, method
return false if method.empty?
@output.merge! method
end
+
def add_model _model
name = _model
_model = Manager.load File.join(Config::Root, 'model'), name
@@ -48,14 +51,16 @@ module Oxidized
return false if _model.empty?
@model.merge! _model
end
+
def add_source _source
- return nil if @source.key? _source
+ return nil if @source.has_key? _source
_source = Manager.load Config::SourceDir, _source
return false if _source.empty?
@source.merge! _source
end
+
def add_hook _hook
- return nil if @hook.key? _hook
+ return nil if @hook.has_key? _hook
name = _hook
_hook = Manager.load File.join(Config::Root, 'hook'), name
_hook = Manager.load Config::HookDir, name if _hook.empty?