title: ruby each.with_index - reflect input
body: <p>I have looked around for info on how to do this, just can't quite get it myself. Fairly new to Ruby and I'm building a gem. I can return a list of results from a website ok with Nokogiri. </p>
  
  <p>The issue I'm having is how to take an input number and relate it to another piece of text from the website I'm scraping. So you pick a movie title by number from a list and then you return the relevant movie outline. Maybe I don't want to iterate through all the objects (again) at all.   </p>
  
  <p>This is what I'm looking at: </p>
  
  <pre><code>def menu
    input = nil
    while input != "exit"
      input = gets.strip.downcase
      if input.to_i &lt; 24
        @movies.each.with_index(1) do |movie, i|
          puts "Description: #{movie.outline}"
        end
      end
    end
  end
  </code></pre>
  
  <p>So we create a variable for input. While the input is not the word exit and less than the number 24, we iterate through the movies and put the relevant one by index number. Currently putting ALL the movie outlines so I feel like I should ditch the iteration. I've tried a number of things around adding the input to movie.outline... </p>
  
  <p>Any help or hints would be great!  </p>