【发布时间】:2013-04-17 14:44:39
【问题描述】:
我对 Rubygem 产生了兴趣,开始探索它是如何工作的,发现 1.9 之后,Rubygem 的 require 变成了 THE require。
使用下面的代码:
require 'debugger'
debugger
require 'thor'
我开始使用n 和l 和s,但卡在:
# specification.rb:263
def self._all # :nodoc:
unless defined?(@@all) && @@all then
specs = {}
self.dirs.each { |dir|
Dir[File.join(dir, "*.gemspec")].each { |path|
spec = Gem::Specification.load path.untaint
# #load returns nil if the spec is bad, so we just ignore
# it at this stage
specs[spec.full_name] ||= spec if spec
}
}
@@all = specs.values
_resort!
end
@@all
end
看来在踏入上述方法之前,@@all已经做好了准备。然后我在@@all =处处设置断点,但没有一个断点到达。
我错过了什么???
编辑:
再看我的问题。见require 'debugger'?我觉得自己像个傻瓜。
现在的问题是“如何调试require”?
关闭:
【问题讨论】:
-
你说的«我开始
n&&l&&s»是什么意思?self._all来自哪里? -
我试图澄清你的问题,如果你不同意,请帮助自己......
-
@BeatRichartz n&&l&&s == next&&list&&step,调试器中的命令
-
"next&&list&&step" 那么请把这些拼写出来。使用自己的速记只会让不懂的人感到困惑。请记住,世界各地的人们都会访问 Stack Overflow。
-
如果问题发生了变化,请打开一个新问题。您的问题的标题和正文与“我如何调试
require”几乎没有关系,这个问题值得拥有自己的空间。