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.



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

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



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

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

#add_input(name) ⇒ Object



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

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

#add_model(name) ⇒ Object



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

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

#add_output(name) ⇒ Object



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

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

#add_source(name) ⇒ Object



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

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