lib/utilities.rb in test-harness-0.4.14 vs lib/utilities.rb in test-harness-0.6.0

- old
+ new

@@ -15,7 +15,20 @@ names.each do |name| constant = constant.const_defined?(name) ? constant.const_get(name) : constant.const_missing(name) end constant end + + def get_parent_class(klass) + parent_class_name = klass.name =~ /::[^:]+\Z/ ? $`.freeze : nil + parent_class_name ? constantize(parent_class_name) : Object + end + + def register_components(component_type) + Dir.glob(File.join(TestHarness.autoload_path, "#{component_type}/**/**.rb")).each do |file| + component = file.sub(TestHarness.autoload_path, '').sub(/^\/?#{component_type}\//, '').sub(/\.rb$/, '') + require file + yield component if block_given? + end + end end -end \ No newline at end of file +end