What good alternatives to read user input are their in Ruby?! I have
been using the gets.chomp method. But if you wanna pass in a range of
valid options to get read?! Like for example option 1 takes you
somewhere and option 3 takes you some other where etc. I know about the
highline gem but then other people that use this have to install it as
well so I dont want to use that. I was thinking something like defining
a method like this:
attr_reader :options
# Pass in array of options
def initialize(options)
@options = options
end
And then calling to it from another method. How can you do that?! I am
really in the beginning of my learning process of Ruby but loving the
language.
Regards
···
--
Posted via http://www.ruby-forum.com/.