在emoticons_hash.each尝试在.each内部使用它之前或在它不会触发它之前,尝试使用它都是有效的。它在这个程序的其他方法中也不起作用,即使后面有一个puts "hello"。
require 'pry'
require 'yaml'
def load_library(filepath)
emoticons_hash = YAML.load_file (filepath)
puts emoticons_hash.inspect
language_hash = {}
emoticons_hash.each do |emoticon|
language_hash[emoticon] = emoticons_hash[emoticon].value
binding.pry
end
binding.pry
puts "hello"
end
def english
binding.pry
puts "hello"
end发布于 2020-10-21 22:25:56
你的emoticons_hash变量里有什么东西吗?如果是,则返回.each方法?
我认为你的binding.pry不是以这种方式到达的,因为这两个问题之一。
https://stackoverflow.com/questions/64383774
复制相似问题