2016-04-06 7 views
2

Mit dem byebug Juwel gibt mir die Möglichkeit, continue bis zum nächsten Haltepunkt fortzusetzen:Wie ohne Stützpunkte in Byebug

(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 

ich überall sah und ich einen Weg nicht finden kann „ohne Stützpunkte weiter“. Der einzige Weg, an den ich denken kann, ist, die byebug Anweisungen zu entfernen oder zu kommentieren, mit q! zu beenden und den Test neu zu starten.

Wie kann ich fortfahren, ohne an anderen byebug Anweisungen in Ruby zu stoppen?

Antwort

5

Ein byebug Methodenaufruf in Ihrem Code ist kein 'Breakpoint' (Denken an die Referenzen auf Haltepunkt in der Hilfe-Ausgabe).

Wie in der Hilfe-Ausgabe kann breakpoint s mit dem Befehl disable deaktiviert werden. Aber das löst Ihr Problem nicht, weil die nächste byebug die Ausführung erneut pausiert.

Da byebug ist nur ein Methodenaufruf, können Sie es abhängig machen:

byebug if SomeModule.byebug? 

Dann in Some, können Sie eine globale Variable verwenden, um es ein-/ausschalten. Sie müssten das entweder bei all Ihren Aufrufen von byebug tun, oder Sie könnten die byebug-Methode mit dem affe-patchen ausführen, um dasselbe zu tun, alias_method_chain oder etwas Ähnliches.

"Make Byebug finish executing without exiting Pry" ist eine ähnliche Antwort.

Verwandte Themen