pry/pry — pull request #923 by ustuehler (2013-05-12 23:38:08+00:00)
Title: Fix source lookup for instrumented classes

Once I include DataMapper::Resource, which defines a lot of
additional methods in dm-core/support/hook.rb, the "popularity"
of my own source file ranks lower than first, so candidate(0)
returns the DataMapper source file. However, none of the REs
returned by Pry::WrappedModule::Candidate#class_regexes
matches because my class is obviously not defined there.

This fixes the problem by re-defining #primary_candidate so that
it filters out obviously invalid candidates.