lib/method_log/commit.rb in method_log-0.0.7 vs lib/method_log/commit.rb in method_log-0.1.0
- old
+ new
@@ -37,13 +37,13 @@
def contains?(source_file)
source_files_by_path[source_file.path] == source_file
end
- def find(method_identifier)
+ def find(method_identifier, last_source_file = nil)
method_definition = nil
method_name = method_identifier.split(Regexp.union('#', '.')).last
- source_files.each do |source_file|
+ source_files.sort_by { |sf| last_source_file == sf ? 1 : 0 }.each do |source_file|
next unless source_file.source[Regexp.new(method_name)]
method_finder = MethodFinder.new(source_file)
break if method_definition = method_finder.find(method_identifier)
end
method_definition
\ No newline at end of file