Method: Async::Service::Loader.load_file

Defined in:
lib/async/service/loader.rb

.load_file(configuration, path) ⇒ Object

Load the specified file into the given configuration.



28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/async/service/loader.rb', line 28

def self.load_file(configuration, path)
	realpath = ::File.realpath(path)
	root = ::File.dirname(realpath)
	
	loader = self.new(configuration, root)
	
	if ::Module.method_defined?(:set_temporary_name)
		loader.singleton_class.set_temporary_name("#{self}[#{path.inspect}]")
	end
	
	loader.instance_eval(File.read(path), path)
end