假设我在HashSample.rb中有这些代码行
require "yaml"
require 'pry'
require 'pry-debugger'
require 'pry-nav'
def set_choice(choice)
choice = "Choice456!@#"
end
hash_map = YAML.load(File.open("#{File.dirname(__FILE__)}/Event.yml"))
event = hash_map["Event"]
puts event.class
binding.pry
event_start_page_hash = event["RegForm"]["Start"]
event_visibility_hash = event_start_page_hash["EventVisibility"]
puts event_visibility_hash["Choice"]
event_visibility_choice = event_visibility_hash["Choice"]
event_visibility_choice = "IllegalChoice"
puts event_visibility_choice
# puts event_visibility_hash["Choice"]
# event_visibility_hash["Choice"] = "Choice123"
# puts event_start_page_hash["EventVisibility"]["Choice"]
# puts event["RegForm"]["Start"]["EventVisibility"]["Choice"]
binding.pry
set_choice(event_visibility_choice)
puts event_visibility_choice
puts event_visibility_hash["Choice"]
set_choice(event_visibility_hash["Choice"])
puts event_visibility_choice
puts event_visibility_hash["Choice"]
然后我打开一个终端并执行此文件ruby HashSample.rb
,它在第一个binding.pry
处停止,并且我输入了pry命令next
,它跳转到第二个binding.pry
而不是执行下一行。
在第二个binding.pry
,我输入了pry命令step
,但它一直运行到最后而不是进入方法set_choice
。
根据{{3}},
步骤:步骤执行到下一行或方法。采用可选的数字参数进行多次步进
next:跳到同一帧内的下一行。还可以使用可选的数字参数来分步多行
我做错了什么?
编辑:我正在使用ruby 1.9.3p429 (2013-05-15 revision 40747) [x86_64-darwin13.3.0]
,并且:
pry (0.10.1)
pry-debugger (0.2.3)
pry-nav (0.2.4)
pry-stack_explorer (0.4.9.2)
编辑1:
我尝试卸载pry-nav
和pry-stack_explorer
,然后next
和step
命令有效。为什么这些宝石有冲突?我在其文档中找不到任何关于此类冲突的内容。有线索吗?