を育てる「必要」私はあなたの中には、感動的ガイドからこれを認識してもよい* file2.rbはNameError
codewords = {'starmonkeys' => 'Five edged primates.'}
の下に、次のハッシュを保存しました!
そしてfile1.rbの下に、次のfile.rb::7:メインのため<main>': undefined local variable or method
コードワードで:オブジェクト(NameError)
私は何をしています
if __FILE__ == $0
require File.expand_path('C:\Users\COMPAQ\My Documents\Aptana Studio Workspace\why the lucky stiff made me do this\file2.rb', __FILE__)
print "Enter your secret sentence."
idea = gets
codewords.each do | real , code|
idea.gsub!(real , code)
end
#Saving to a new file
print "File encoded. Print a file name for this idea"
idea_name = gets.strip
File::open("idea-"+idea_name+".txt","w") do |f|
f<<idea
end
end
私はNameErrorを育てていますこれを引き起こしている間違っている?
ええええええええええええええええええええええええええええええええええええええええええええええええええええええええええええええええええええええええええええええええええええええええええええええええええええええええええええええええええええええええええええええええええ>作者がそこで働くと主張する理由を教えてください。あるいは、私は新しいRubyバージョンでそれを必要とすることはできませんか?ありがとう。 – HareKrishna
@HareKrishna:あなたはこの問題に遭遇する最初の人物ではありません:http://www.falsepositives.com/index.php/2005/09/12/getting-rubys-require-to-work-in-the -poignant-guide-to-ruby/ – zetetic
zeteic、そのリンクは本当に助けました。多くのミラーがダウンしているので、鋭いガイドの固定コピーを見つけることは難しいことです。あなたが1つを知っていれば教えてください。それは言われている、それは私の問題ともう少し修正! – HareKrishna