我使用byebug
知道特定呼叫的来历,但是当我使用where
时,会得到完整回溯。
是否可以过滤where
命令以仅显示我的代码?
例如,这是一个典型的where
结果,它显示127行,但是我想轻松地看到#0,#1,#64和#74行,因为只有这些行是我的“代码”电话”
(byebug) where
--> #0 Account.last_transactions at /home/albert/druby/bankbox/app/models/account.rb:31
#1 Api::V1::TransactionsController.index at /home/albert/druby/bankbox/app/controllers/api/v1/transactions_controller.rb:11
#2 ActionController::BasicImplicitRender.send_action(method#String, *args#Array) at /home/albert/.rvm/gems/ruby-2.6.0@5.2.2/gems/actionpack-5.2.2/lib/action_controller/metal/basic_implicit_render.rb:6
#3 AbstractController::Base.process_action(method_name#String, *args#Array) at /home/albert/.rvm/gems/ruby-2.6.0@5.2.2/gems/actionpack-5.2.2/lib/abstract_controller/base.rb:194
#4 ActionController::Rendering.process_action(*args) at /home/albert/.rvm/gems/ruby-2.6.0@5.2.2/gems/actionpack-5.2.2/lib/action_controller/metal/rendering.rb:30
#5 block in AbstractController::Callbacks.block in process_action(*args#Array) at /home/albert/.rvm/gems/ruby-2.6.0@5.2.2/gems/actionpack-5.2.2/lib/abstract_controller/callbacks.rb:42
#6 ActiveSupport::Callbacks.run_callbacks(kind#Symbol) at /home/albert/.rvm/gems/ruby-2.6.0@5.2.2/gems/activesupport-5.2.2/lib/active_support/callbacks.rb:132
#7 AbstractController::Callbacks.process_action(*args#Array) at /home/albert/.rvm/gems/ruby-2.6.0@5.2.2/gems/actionpack-5.2.2/lib/abstract_controller/callbacks.rb:41
#8 ActionController::Rescue.process_action(*args#Array) at /home/albert/.rvm/gems/ruby-2.6.0@5.2.2/gems/actionpack-5.2.2/lib/action_controller/metal/rescue.rb:22
....
55 more lines
....
#63 block (2 levels) in Rails::Controller::Testing::Integration.block (2 levels) in <module:Integration>(*args#Array) at /home/albert/.rvm/gems/ruby-2.6.0@5.2.2/gems/rails-controller-testing-1.0.4/lib/rails/controller/testing/integration.rb:13
#64 block (2 levels) in RSpec::ExampleGroups::GETApiV1AccountsAccountIdTransactions::LetDefinitions.block (2 levels) in <main> at /home/albert/druby/bankbox/spec/requests/api/v1/transactions/index_spec.rb:7
#65 block (2 levels) in RSpec::ExampleGroups::GETApiV1AccountsAccountIdTransactions.block (2 levels) in let at /home/albert/.rvm/gems/ruby-2.6.0@5.2.2/gems/rspec-core-3.8.0/lib/rspec/core/memoized_helpers.rb:298
#66 block (3 levels) in RSpec::Core::MemoizedHelpers::ThreadsafeMemoized.block (3 levels) in fetch_or_store(key#Symbol) at /home/albert/.rvm/gems/ruby-2.6.0@5.2.2/gems/rspec-core-3.8.0/lib/rspec/core/memoized_helpers.rb:157
ͱ-- #67 Hash.fetch(*args) at /home/albert/.rvm/gems/ruby-2.6.0@5.2.2/gems/rspec-core-3.8.0/lib/rspec/core/memoized_helpers.rb:157
#68 block (2 levels) in RSpec::Core::MemoizedHelpers::ThreadsafeMemoized.block (2 levels) in fetch_or_store(key#Symbol) at /home/albert/.rvm/gems/ruby-2.6.0@5.2.2/gems/rspec-core-3.8.0/lib/rspec/core/memoized_helpers.rb:157
#69 RSpec::Support::ReentrantMutex.synchronize at /home/albert/.rvm/gems/ruby-2.6.0@5.2.2/gems/rspec-support-3.8.0/lib/rspec/support/reentrant_mutex.rb:23
#70 block in RSpec::Core::MemoizedHelpers::ThreadsafeMemoized.block in fetch_or_store(key#Symbol) at /home/albert/.rvm/gems/ruby-2.6.0@5.2.2/gems/rspec-core-3.8.0/lib/rspec/core/memoized_helpers.rb:156
ͱ-- #71 Hash.fetch(*args) at /home/albert/.rvm/gems/ruby-2.6.0@5.2.2/gems/rspec-core-3.8.0/lib/rspec/core/memoized_helpers.rb:155
#72 RSpec::Core::MemoizedHelpers::ThreadsafeMemoized.fetch_or_store(key#Symbol) at /home/albert/.rvm/gems/ruby-2.6.0@5.2.2/gems/rspec-core-3.8.0/lib/rspec/core/memoized_helpers.rb:155
#73 block in RSpec::ExampleGroups::GETApiV1AccountsAccountIdTransactions.block in let at /home/albert/.rvm/gems/ruby-2.6.0@5.2.2/gems/rspec-core-3.8.0/lib/rspec/core/memoized_helpers.rb:298
#74 block (3 levels) in block (3 levels) in <main> at /home/albert/druby/bankbox/spec/requests/api/v1/transactions/index_spec.rb:16
ͱ-- #75 BasicObject.instance_exec(*args) at /home/albert/.rvm/gems/ruby-2.6.0@5.2.2/gems/rspec-core-3.8.0/lib/rspec/core/example.rb:447
#76 RSpec::Core::Example.instance_exec(*args#Array, &block#Proc) at /home/albert/.rvm/gems/ruby-2.6.0@5.2.2/gems/rspec-core-3.8.0/lib/rspec/core/example.rb:447
#77 RSpec::Core::Hooks::BeforeHook.run(example#RSpec::Core::Example) at /home/albert/.rvm/gems/ruby-2.6.0@5.2.2/gems/rspec-core-3.8.0/lib/rspec/core/hooks.rb:348
#78 block in RSpec::Core::Hooks::HookCollections.block in run_owned_hooks_for(position#Symbol, scope#Symbol, example_or_group#RSpec::Core::Example) at /home/albert/.rvm/gems/ruby-2.6.0@5.2.2/gems/rspec-core-3.8.0/lib/rspec/core/hooks.rb:507
ͱ-- #79 Array.each at /home/albert/.rvm/gems/ruby-2.6.0@5.2.2/gems/rspec-core-3.8.0/lib/rspec/core/hooks.rb:506
#80 RSpec::Core::Hooks::HookCollections.run_owned_hooks_for(position#Symb
....
47 more lines
.....
谢谢