Getting 'choice' to work in Highline Ruby Gem without error and getting variable from it

Posted by The Warm Jets on Stack Overflow See other posts from Stack Overflow or by The Warm Jets
Published on 2010-05-23T14:31:31Z Indexed on 2010/05/23 14:41 UTC
Read the original article Hit count: 132

Filed under:
|
|
|
|

I'm having a couple of problems using Highline in Ruby, and trying to get the choice element, detailed here, to work.

  1. At the moment the following code produces the error "error: wrong number of arguments (0 for 1). Use --trace to view backtrace"
  2. How do I get the variable out of choice? At the moment I have the 'do' setup, but I have no idea about how to get the variable the user has chosen out and into a variable for use elsewhere.

Sorry if this is a bit beginner, I'm brand new to ruby and this is my first project, in at the deep end.

Thanks in advance.

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

© Stack Overflow or respective owner

Related posts about ruby

Related posts about command-line