【发布时间】:2015-02-18 17:27:35
【问题描述】:
我在 Ruby Koans 中收到以下错误:
AboutHashes#test_accessing_hashes_with_fetch 破坏了你的业力。
师父说: 你还没有达到觉悟。 我感到沮丧。不要害怕寻求帮助。
您寻求的答案... 需要类或模块
请仔细思考以下代码: /home/s/Downloads/github/rubykoans/about_hashes.rb:26:in `test_accessing_hashes_with_fetch'
有问题的行是以下方法的一部分:
def test_accessing_hashes_with_fetch
hash = { :one => "uno" }
assert_equal "uno", hash.fetch(:one)
assert_raise(nil) do
hash.fetch(:doesnt_exist)
end
如您所见,它要求一个类或模块,所以我很困惑,因为这不是我以前在 Koans 中遇到过的错误。
【问题讨论】:
标签: ruby