如何在 Ruby Shoes 中显示数组的输出?
我将此作为我的代码
openAll = File.open('N:\Josh\Blondie\db.txt')
allNumbers = Array.new
allNumbers=[]
openAll.each_line {|line|
allNumbers.push line
}
puts allNumbers
,我希望能够使用 Ruby Shoes 在新窗口中显示此代码的输出,但我似乎无法让它显示任何内容。文件的内容是姓名和电话号码。
有什么想法吗?
I've got this as my code
openAll = File.open('N:\Josh\Blondie\db.txt')
allNumbers = Array.new
allNumbers=[]
openAll.each_line {|line|
allNumbers.push line
}
puts allNumbers
and I'd like to be able to display the output of this code in a new window with Ruby Shoes, I can't seem to get it to display anything though. The contents of the file are names and phone numbers.
Any ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
下面是将文本输出到鞋子窗口的示例。使用
puts
语句仅输出到 shell,而不是 Shoes 应用程序。Here's an example of outputting text to a shoes window. Using a
puts
statement just outputs to the shell, not to the Shoes app.我想你应该使用方法 Kernel#alert 而不是 Kernel#puts。
http://shoesrb.com/manual/Built-in.html
I guess you should use the method Kernel#alert instead of Kernel#puts.
http://shoesrb.com/manual/Built-in.html