From 61c7227675c22f18282747ebc80a149db3bb8b9d Mon Sep 17 00:00:00 2001 From: Conrad Irwin Date: Thu, 28 Jun 2012 01:28:11 -0700 Subject: [PATCH] Don't call .alias? in WrappedModule#source_location Unfortunately, alias? requires loading the entire source code for each method, so this can get pretty slow for modules that include hundreds of methods. --- lib/pry/wrapped_module.rb | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/lib/pry/wrapped_module.rb b/lib/pry/wrapped_module.rb index 2cf3174a..f22118c1 100644 --- a/lib/pry/wrapped_module.rb +++ b/lib/pry/wrapped_module.rb @@ -223,13 +223,7 @@ class Pry ims = all_methods_for(wrapped) - ims.reject! do |v| - begin - v.alias? || v.source_location.nil? - rescue Pry::RescuableException - true - end - end + ims.select!(&:source_location) @all_source_locations_by_popularity = ims.group_by { |v| Array(v.source_location).first }. sort_by { |k, v| -v.size }