我有以下 Ruby 脚本:
begin
puts "What is the password? "
the_pass = ask("") { |q| q.echo = "*" }
end while the_pass == nil || the_pass == "\n" || the_pass == ""
当我按 Enter 时它失败了:
未定义的方法
default_external' for REXML::Encoding:Module /Library/Ruby/Gems/1.8/gems/highline-1.6.19/lib/highline.rb:621:in
说'/Library/Ruby/Gems/1.8/gems/highline-1.6.19/lib/highline.rb:914:inget_response' /Library/Ruby/Gems/1.8/gems/highline-1.6.19/lib/highline.rb:259:in
ask'
验证输入时似乎失败了the_pass
,但我无法理解错误,它们有什么关系?
谢谢