1
0
Fork 0
mirror of https://github.com/pry/pry.git synced 2022-11-09 12:35:05 -05:00

Merge pull request #923 from ustuehler/patch-1

Fix source lookup for instrumented classes
This commit is contained in:
John Mair 2013-05-19 08:18:08 -07:00
commit 0004cfde97

View file

@ -300,12 +300,17 @@ class Pry
end
end
# @return [Pry::WrappedModule::Candidate] The candidate of rank 0,
# that is the 'monkey patch' of this module with the highest
# number of methods. It is considered the 'canonical' definition
# for the module.
# @return [Pry::WrappedModule::Candidate] The candidate with the
# highest rank, that is the 'monkey patch' of this module with the
# highest number of methods, which contains a source code line that
# defines the module. It is considered the 'canonical' definition
# for the module. In the absense of a suitable candidate, the
# candidate of rank 0 will be returned, or a CommandError raised if
# there are no candidates at all.
def primary_candidate
@primary_candidate ||= candidate(0)
@primary_candidate ||= candidates.find { |c| c.file } ||
# This will raise an exception if there is no candidate at all.
candidate(0)
end
# @return [Array<Array<Pry::Method>>] The array of `Pry::Method` objects,