0

尝试使用binding.pry有效,直到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
4

1 回答 1

0

emoticons_hash你的变量里有东西吗?如果是,它响应.each方法?

我认为您binding.pry没有达到这种方式是因为这两个问题之一。

于 2020-10-21T14:25:56.037 回答