module NoSE::Loader::ClassMethods
Add a class method to load class instances from file
Public Instance Methods
load(name)
click to toggle source
Load a class with the given name from a directory specified by the LOAD_PATH class constant @return [Object] an instance of the class which included this module
# File lib/nose/util.rb, line 278 def load(name) if File.exist? name filename = name else path = const_get(:LOAD_PATH) filename = File.expand_path "../../../#{path}/#{name}.rb", __FILE__ end source_code = File.read(filename) instance = binding.eval source_code, filename instance.instance_variable_set :@source_code, source_code instance end