在 Rails 项目中找不到原点对象 [英] Cannot find origin object in Rails project
问题描述
我刚刚为一个新的演出继承了一个 Rails 应用程序.你的代码很疯狂,并且深深地埋在了 gem 逻辑中,所以导航非常困难,而且不符合轨道.我很难追踪以下逻辑.
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)
我到处(在应用程序和 gem 目录中)搜索 BitPlayer 类/对象以及导航器,但找不到任何东西.我想我不明白这条线的基本组成.
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.
有人能指出我在哪里寻找这个的正确方向吗?我迫切需要找到那个Navigator.new".方法!
Can someone point me in the right direction where to look for this? I desperately need to find that "Navigator.new" method!
推荐答案
你可以试试 Method#source_location
.例如:
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]
然后查看我们看到的文件的第 29 行:
And then looking line 29 of the file we see:
def fragment string, encoding = nil
所以开始:
BitPlayer::Navigator.method(:initialize).source_location
这篇关于在 Rails 项目中找不到原点对象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!