我知道这个问题可能看起来非常具体, 但我试图更新一些脚本, 以便运行在 Ruby 1. 9 上, 并且多次遇到这个非常相似的错误。 我试图在此运行此代码 : < a href=" http://x.gfax.ch/ Archives/Scripts/boggle.rb" rel = "nofollow" > http://x.gfax.ch/ Argives/Scripts/bogle.rb , 但卡在 :
def Dict.to_n(ch)
ch[0]- a [0]
end
在 Ruby1.8 中, 这将生成一个随机 NxN boggle 板, 然后找到并输出它能找到的所有单词。 但在 Ruby1. 9 中, 翻译给我这个信息 :
boggle.rb:182:in `to_n : undefined method `- for "a":String (NoMethodError)
我的语法有什么问题吗? (如果你需要一个字典文件来播放脚本, 我使用此示例页底部的字典文件 : < a href="http://learnruby.com/bogle/index.shtml" rel=“ nofollow” >http://learnruby.com/bogle/index.shtml ) 感谢您提前为任何指导 。