10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
# File 'lib/adhearsion/component_manager/component_tester.rb', line 10
def new(component_name, component_directory)
component_directory = File.expand_path component_directory
main_file = component_directory + "/#{component_name}/#{component_name}.rb"
component_manager = Adhearsion::Components::ComponentManager.new(component_directory)
component_module = Adhearsion::Components::ComponentManager::ComponentDefinitionContainer.load_file main_file
Module.new do
extend ComponentTester
(class << self; self; end).send(:define_method, :component_manager) { component_manager }
(class << self; self; end).send(:define_method, :component_name) { component_name }
(class << self; self; end).send(:define_method, :component_module) { component_module }
(class << self; self; end).send(:define_method, :component_directory) { component_directory }
define_method(:component_manager) { component_manager }
define_method(:component_name) { component_name }
define_method(:component_module) { component_module }
define_method(:component_directory) { component_directory }
def self.const_missing(name)
component_module.const_get name
end
end
end
|