Class: Oxidized::Manager
- Inherits:
-
Object
- Object
- Oxidized::Manager
- Defined in:
- lib/oxidized/manager.rb
Instance Attribute Summary collapse
-
#hook ⇒ Object
readonly
Returns the value of attribute hook.
-
#input ⇒ Object
readonly
Returns the value of attribute input.
-
#model ⇒ Object
readonly
Returns the value of attribute model.
-
#output ⇒ Object
readonly
Returns the value of attribute output.
-
#source ⇒ Object
readonly
Returns the value of attribute source.
Class Method Summary collapse
Instance Method Summary collapse
- #add_hook(_hook) ⇒ Object
- #add_input(method) ⇒ Object
- #add_model(_model) ⇒ Object
- #add_output(method) ⇒ Object
- #add_source(_source) ⇒ Object
-
#initialize ⇒ Manager
constructor
A new instance of Manager.
Constructor Details
#initialize ⇒ Manager
Returns a new instance of Manager.
27 28 29 30 31 32 33 |
# File 'lib/oxidized/manager.rb', line 27 def initialize @input = {} @output = {} @model = {} @source = {} @hook = {} end |
Instance Attribute Details
#hook ⇒ Object (readonly)
Returns the value of attribute hook.
26 27 28 |
# File 'lib/oxidized/manager.rb', line 26 def hook @hook end |
#input ⇒ Object (readonly)
Returns the value of attribute input.
26 27 28 |
# File 'lib/oxidized/manager.rb', line 26 def input @input end |
#model ⇒ Object (readonly)
Returns the value of attribute model.
26 27 28 |
# File 'lib/oxidized/manager.rb', line 26 def model @model end |
#output ⇒ Object (readonly)
Returns the value of attribute output.
26 27 28 |
# File 'lib/oxidized/manager.rb', line 26 def output @output end |
#source ⇒ Object (readonly)
Returns the value of attribute source.
26 27 28 |
# File 'lib/oxidized/manager.rb', line 26 def source @source end |
Class Method Details
.load(dir, file) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/oxidized/manager.rb', line 8 def load dir, file begin 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.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 |
Instance Method Details
#add_hook(_hook) ⇒ Object
57 58 59 60 61 62 63 64 |
# File 'lib/oxidized/manager.rb', line 57 def add_hook _hook return nil if @hook.key? _hook name = _hook _hook = Manager.load File.join(Config::Root, 'hook'), name _hook = Manager.load Config::HookDir, name if _hook.empty? return false if _hook.empty? @hook.merge! _hook end |
#add_input(method) ⇒ Object
34 35 36 37 38 |
# File 'lib/oxidized/manager.rb', line 34 def add_input method method = Manager.load Config::InputDir, method return false if method.empty? @input.merge! method end |
#add_model(_model) ⇒ Object
44 45 46 47 48 49 50 |
# File 'lib/oxidized/manager.rb', line 44 def add_model _model name = _model _model = Manager.load File.join(Config::Root, 'model'), name _model = Manager.load Config::ModelDir, name if _model.empty? return false if _model.empty? @model.merge! _model end |