10

byebuggem を使用するとcontinue、次のブレークポイントまで次のことができます。

(byebug) help

  break      -- Sets breakpoints in the source code
  catch      -- Handles exception catchpoints
  condition  -- Sets conditions on breakpoints
  continue   -- Runs until program ends, hits a breakpoint or reaches a line
  delete     -- Deletes breakpoints
  disable    -- Disables breakpoints or displays
  display    -- Evaluates expressions every time the debugger stops
  down       -- Moves to a lower frame in the stack trace
  edit       -- Edits source files
  enable     -- Enables breakpoints or displays
  finish     -- Runs the program until frame returns
  frame      -- Moves to a frame in the call stack
  help       -- Helps you using byebug
  history    -- Shows byebug's history of commands
  info       -- Shows several informations about the program being debugged
  interrupt  -- Interrupts the program
  irb        -- Starts an IRB session
  kill       -- Sends a signal to the current process
  list       -- Lists lines of source code
  method     -- Shows methods of an object, class or module
  next       -- Runs one or more lines of code
  pry        -- Starts a Pry session
  ps         -- Evaluates an expression and prettyprints & sort the result
  quit       -- Exits byebug
  restart    -- Restarts the debugged program
  save       -- Saves current byebug session to a file
  set        -- Modifies byebug settings
  show       -- Shows byebug settings
  source     -- Restores a previously saved byebug session
  step       -- Steps into blocks or methods one or more times
  thread     -- Commands to manipulate threads
  tracevar   -- Enables tracing of a global variable
  undisplay  -- Stops displaying all or some expressions when program stops
  untracevar -- Stops tracing a global variable
  up         -- Moves to a higher frame in the stack trace
  var        -- Shows variables and its values
  where      -- Displays the backtrace

いろいろ調べましたが、「ブレークポイントなしで続行」する方法が見つかりません。私が考えることができる唯一の方法は、byebugステートメントを削除またはコメントし、終了しq!てテストを再開することです。

byebugRubyの他のステートメントで停止せずに続行するにはどうすればよいですか?

4

3 に答える 3

5

コード内のbyebugメソッド呼び出しは「ブレークポイント」ではありません (ヘルプ出力のブレークポイントへの参照を考えてください)。

ヘルプ出力によるbreakpointと、コマンドで s を無効にすることができますdisablebyebugしかし、次は実行を再び一時停止するため、問題は解決しません。

byebugは単なるメソッド呼び出しであるため、条件付きにすることができます。

byebug if SomeModule.byebug?

次に、SomeModule で、グローバル変数を使用してオン/オフを切り替えることができます。byebug へのすべての呼び出しでそれを行う必要があるか、byebug メソッドにモンキーパッチを適用して同じこと、alias_method_chainまたは類似のことを行うことができます。

Pry を終了せずに Byebug の実行を終了させる」も同様の答えです。

于 2016-04-06T21:48:46.227 に答える