我在Ruby中使用Highline时遇到了一些问题,并试图让选择元素detailed here工作。获取'选择'在Highline Ruby Gem中工作而没有错误并且从中变得可变
- 在下面的代码产生错误 的时刻“的错误:错误的参数数目(0 1)使用--trace查看回溯。”
- 我怎么变出来的选择?目前我有'做'设置,但我不知道如何获得用户选择的变量并将其用于其他地方使用的变量。
对不起,如果这是一个初学者,我是全新的红宝石,这是我的第一个项目,在深处。
在此先感谢。
if agree("Are these files going to be part of a set? ")
set_title = ask("Title: ")
set_desc = ask("Description:")
set_genre = ask("Genre: ")
set_label = ask("Record Label: ")
set_date = ask_for_date("Release Date (yy-mm-dd): ")
set_label = ask("EAN/UPC: ")
set_buy = ask("Buy this set link: ")
set_tags = ask_for_array("Tags (seperated by space): ")
# Sort out license
choose do |menu|
menu.prompt = "Please choose the license for this set? "
menu.choices(:all_rights_reserved, :cc_by) do
# put the stuff in a variable
end
end
end # End setup set
哪线给你一个问题,到底是什么? 'choose'部分在Ruby 1.8或1.9中正常工作。 'ask_for_date'似乎是一个自定义的方法,因为'ask_for_array',所以不能帮你在那里... – 2010-05-23 15:01:00
这是我的会话记录: \t Alex-Andrewss-MacBook-Pro:SoundCloud- CLI alex $ ruby sc.rb上传/用户/ alex/SoundCloud-CLI \t这些文件将成为集合的一部分吗? ÿ \t名称:你好 \t描述: \t你好 \t类型:你好 \t唱片:你好 \t发行日期(年 - 月 - 日):10年9月10日 \t EAN/UPC:你好 \t购买此套件链接:你好 \t标签(空格隔离):你好好友 \t错误:参数数量错误(0代表1)。使用 - 跟踪查看回溯 非常感谢您的帮助。 – Alex 2010-05-23 19:47:56