diff options
author | ytti <saku@ytti.fi> | 2018-04-25 16:12:44 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-04-25 16:12:44 +0300 |
commit | 583bc422448a234a215113a15f8a6976c50b2296 (patch) | |
tree | b3f757e6f37aa058a0c80e4ded3ef82553bc98c1 /lib/oxidized/manager.rb | |
parent | 9a7d16c00163c421d2c9f3cb2783c76633860336 (diff) | |
parent | dffae0f76656a57da8f5473ce21955638cbe1f7f (diff) |
Merge pull request #1296 from wk/the-great-makeover
the great makeover - standardize layout, alignment, indentation
Diffstat (limited to 'lib/oxidized/manager.rb')
-rw-r--r-- | lib/oxidized/manager.rb | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/oxidized/manager.rb b/lib/oxidized/manager.rb index d2ef4d2..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,12 +51,14 @@ module Oxidized return false if _model.empty? @model.merge! _model end + def add_source _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.has_key? _hook name = _hook |