【发布时间】:2010-09-27 17:52:36
【问题描述】:
我有一个向用户显示组合框的函数。
def select_interface(interfaces)
list_box :items => interfaces do |list|
interface = list.text
end
### ideally should wait until interface has a value then: ###
return interface
end
程序的其余部分取决于此组合框中的选择。
我想找到一种方法让 ruby 等待来自组合框的输入,然后执行其余代码。
shoes 中有一个类似的函数,叫做 ask,它会等待用户的输入。
interface = ask("write your interface here")
如何在 Ruby/shoes 中实现这个“等到变量有值”的功能?
【问题讨论】: