2017-12-06 3 views
1

Wie greifen wir auf die Variablennamen zu, die mit dem reservierten Namen byebug in Konflikt stehen?Wie greifen wir auf Variablennamen zu/manipulieren, die mit byebug reservierten Schlüsselwörtern in Konflikt stehen?

(byebug) var local 
h = {"hierarchyId"=>"59f0b029e4b037ef11a055f7", "level"=>2, ... 
self =     <div class="index_as_table"></div> 

user = #<CollaborationUser:0x007f82a8039328> 
(byebug) 

Ich möchte Variable für den Zugriff auf „h“

aber h eingeben würde die „Hilfe-Dialogfeld für byebug“

(byebug) h 

    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 
    debug  -- Spawns a subdebugger 
    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 
    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) 

Gibt es irgendeine Art und Weise zeigen, bis zu Variablen zugreifen, die mit Konflikten Diese reservierten Keyword-Namen. wie Ausrufezeichen Präfix in Python pdb? (!h funktionierte nicht für byebug)

+4

Die Readme schlägt vor, ' eval h' könnte funktionieren? – Ryan

+1

Oder Sie können 'p h' tun. 'p' für den Druck. –

Antwort

3

Sie können es alternativ umgeben in Klammern:

[1, 4] in /Users/max/test.rb 
    1: require 'byebug' 
    2: 
    3: byebug 
=> 4: false 
(byebug) (h = 1) 
1 
(byebug) (h) 
1 
(byebug) 
Verwandte Themen