Class: Config::ItemFactory
- Inherits:
-
Object
- Object
- Config::ItemFactory
show all
- Defined in:
- lib/module_config/itemfactory.rb
Direct Known Subclasses
ComplexFactory, ComplexFreqenciesFactory, ComplexLibraryFactory, ComplexPackageFactory, ComplexPinsFactory, ComplexUnitFactory, SimpelPostLayoutSimSDFFactory, SimpleArchitectureFactory, SimpleBinDirFactory, SimpleBoolFactory, SimpleFactory, SimpleSimulateRunFactory, SimpleVerboseFactory
Constant Summary
collapse
- @@factories =
[]
Class Method Summary
collapse
Class Method Details
.create ⇒ Object
45
46
47
|
# File 'lib/module_config/itemfactory.rb', line 45
def ItemFactory.create()
raise NotImplementedError, "You have to implement create() in sublcasses inherited from Config::ItemFactory!"
end
|
.factories ⇒ Object
14
15
16
|
# File 'lib/module_config/itemfactory.rb', line 14
def ItemFactory.factories()
@@factories
end
|
.getItemFor(_str) ⇒ Object
19
20
21
22
23
24
25
26
27
28
|
# File 'lib/module_config/itemfactory.rb', line 19
def ItemFactory.getItemFor(_str)
@@factories.each do |subclass|
match = subclass.match(_str) if !match.nil?
return subclass.create(match)
end
end
raise ConfigException.new(self.class), "There were some wrong entries in your configfile:\n -----\n #{_str.strip}\n -----"
end
|
.inherited(_if) ⇒ Object
9
10
11
|
# File 'lib/module_config/itemfactory.rb', line 9
def ItemFactory.inherited(_if)
@@factories.push(_if)
end
|
.load(_dir) ⇒ Object
31
32
33
34
35
36
37
38
|
# File 'lib/module_config/itemfactory.rb', line 31
def ItemFactory.load(_dir)
Dir.open(_dir).each do |file|
if file =~ /[.]rb$/
require _dir+"/"+file
end
end
@@factories.sort! { |x,y| x.priority <=> y.priority }
end
|
.match(_str) ⇒ Object
40
41
42
|
# File 'lib/module_config/itemfactory.rb', line 40
def ItemFactory.match(_str)
raise NotImplementedError, "You have to implement match() in sublcasses inherited from Config::ItemFactory!"
end
|
.priority ⇒ Object
49
50
51
|
# File 'lib/module_config/itemfactory.rb', line 49
def ItemFactory.priority()
0
end
|