Class: Oxidized::Manager

Inherits:
Object
  • Object
show all
Defined in:
lib/oxidized/manager.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeManager

Returns a new instance of Manager.



26
27
28
29
30
31
32
# File 'lib/oxidized/manager.rb', line 26

def initialize
  @input  = {}
  @output = {}
  @source = {}
  @model  = {}
  @hook   = {}
end

Instance Attribute Details

#hookObject (readonly)

Returns the value of attribute hook.



25
26
27
# File 'lib/oxidized/manager.rb', line 25

def hook
  @hook
end

#inputObject (readonly)

Returns the value of attribute input.



25
26
27
# File 'lib/oxidized/manager.rb', line 25

def input
  @input
end

#modelObject (readonly)

Returns the value of attribute model.



25
26
27
# File 'lib/oxidized/manager.rb', line 25

def model
  @model
end

#outputObject (readonly)

Returns the value of attribute output.



25
26
27
# File 'lib/oxidized/manager.rb', line 25

def output
  @output
end

#sourceObject (readonly)

Returns the value of attribute source.



25
26
27
# File 'lib/oxidized/manager.rb', line 25

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
# File 'lib/oxidized/manager.rb', line 8

def load(dir, file)
  require File.join dir, file + '.rb'
  klass = nil
  [Oxidized, Object].each do |mod|
    klass   = mod.constants.find { |const| const.to_s.casecmp(file).zero? }
    klass ||= mod.constants.find { |const| const.to_s.downcase == 'oxidized' + 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
  false
end

Instance Method Details

#add_hook(name) ⇒ Object



50
51
52
# File 'lib/oxidized/manager.rb', line 50

def add_hook(name)
  loader @hook, Config::HookDir, "hook", name
end

#add_input(name) ⇒ Object



34
35
36
# File 'lib/oxidized/manager.rb', line 34

def add_input(name)
  loader @input, Config::InputDir, "input", name
end

#add_model(name) ⇒ Object



46
47
48
# File 'lib/oxidized/manager.rb', line 46

def add_model(name)
  loader @model, Config::ModelDir, "model", name
end

#add_output(name) ⇒ Object



38
39
40
# File 'lib/oxidized/manager.rb', line 38

def add_output(name)
  loader @output, Config::OutputDir, "output", name
end

#add_source(name) ⇒ Object



42
43
44
# File 'lib/oxidized/manager.rb', line 42

def add_source(name)
  loader @source, Config::SourceDir, "source", name
end