加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

ruby – 我们如何访问/操作与byebug保留关键字冲突的变量名?

发布时间:2020-12-17 04:02:53 所属栏目:百科 来源:网络整理
导读:我们如何访问那些与byebug保留名称冲突的变量名? (byebug) var localh = {"hierarchyId"="59f0b029e4b037ef11a055f7","level"=2,...self = div class="index_as_table"/divuser = #CollaborationUser:0x007f82a8039328(byebug) 我想访问变量“h” 但输入h将
我们如何访问那些与byebug保留名称冲突的变量名?

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

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

我想访问变量“h”

但输入h将显示“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)

有没有办法访问与这些保留关键字名称冲突的变量.像python的pdb中的感叹号前缀? (!h不适用于byebug)

解决方法

您也可以用括号括起来:

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

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读