# Variations to gets.chomp for user input?!

**URL:** <https://www.ruby-forum.com/t/variations-to-gets-chomp-for-user-input/194862>\
**Category:** Ruby\
**Created:** [September 12, 2010, 4:55pm UTC](https://www.ruby-forum.com/t/variations-to-gets-chomp-for-user-input/194862 "2010-09-12T16:55:33Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![timrohde](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/94ad74/32.png) [@timrohde](https://www.ruby-forum.com/u/timrohde)\
**Post date:** [September 12, 2010, 4:55pm UTC](https://www.ruby-forum.com/t/variations-to-gets-chomp-for-user-input/194862/1 "2010-09-12T16:55:33Z")

</div>

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
