Permalink
Browse files

use same looping mechanism

  • Loading branch information...
1 parent c31b771 commit fb7ea85defdcf16f147dd573a52d0791dc22468f unclebob committed Dec 4, 2008
Showing with 7 additions and 3 deletions.
  1. +7 −3 lib/statement_executor.rb
View
@@ -41,9 +41,13 @@ def construct(class_name, constructor_arguments)
end
end
+
+ def with_fully_qualified_class_name(class_name, &block)
+ (@modules.map{|module_name| module_name + "::" + class_name} << class_name).reverse.each &block
+ end
def require_class(class_name)
- (@modules.map{|module_name| module_name + "::" + class_name} << class_name).reverse.each {|fqn|
- path = make_path_to_class(fqn)
+ with_fully_qualified_class_name(class_name) {|class_name|
+ path = make_path_to_class(class_name)
begin
require path
return
@@ -54,7 +58,7 @@ def require_class(class_name)
end
def get_class(class_name)
- (@modules.map{|module_name| module_name + "::" + class_name} << class_name).reverse.each {|class_name|
+ with_fully_qualified_class_name(class_name) {|class_name|
module_names = split_class_name(class_name)
first_pass_name = module_names.join("::")
begin

0 comments on commit fb7ea85

Please sign in to comment.