当单步执行 Rails 中的 Ruby 调试器时,我如何让它只停留在我编写的代码上,跳过所有本机 Rails 代码?
(即跳过所有看起来像这样的代码)
/Users/jon/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.2.1/lib/active_support/core_ext/module/remove_method.rb:4
remove_method(method)
(rdb:1) s
[76, 85] in /Users/jon/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.2.1/lib/active_support/core_ext/class/attribute.rb
76 def self.#{name}?() !!#{name} end
77
78 def self.#{name}=(val)
79 singleton_class.class_eval do
80 remove_possible_method(:#{name})
=> 81 define_method(:#{name}) { val }
82 end
83
84 if singleton_class?
85 class_eval do
/Users/jon/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.2.1/lib/active_support/core_ext/class/attribute.rb:81
define_method(:#{name}) { val }
(rdb:1) s
[79, 88] in /Users/jon/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.2.1/lib/active_support/core_ext/class/attribute.rb
79 singleton_class.class_eval do
80 remove_possible_method(:#{name})
81 define_method(:#{name}) { val }
82 end
83
=> 84 if singleton_class?
85 class_eval do
86 remove_possible_method(:#{name})
87 def #{name}
88 defined?(@#{name}) ? @#{name} : singleton_class.#{name}
谢谢!