问题
I just inherited a Rails app for a new gig. Thee code is insane and heavily buried in gem logic so VERY difficult and un-rails-like to navigate. I am having a terrible time tracking down the following logic.
@navigator ||= BitPlayer::Navigator.new(current_participant)
I have searched everywhere (in app as well as gem dirs) for a BitPlayer class/object as well as Navigator and cannot find a thing. I am thinking I don't understand the fundamental composition of the line.
Can someone point me in the right direction where to look for this? I desperately need to find that "Navigator.new" method!
回答1:
You could try Method#source_location. For example:
Nokogiri::HTML.method(:fragment).source_location
# ["/Users/mu/.../gems/nokogiri-1.10.10/lib/nokogiri/html.rb", 29]
And then looking line 29 of the file we see:
def fragment string, encoding = nil
So start with:
BitPlayer::Navigator.method(:initialize).source_location
来源:https://stackoverflow.com/questions/63974323/cannot-find-origin-object-in-rails-project