title: while condition keep on injecting ruby
body: <p>I want to generate fibonacci series in ruby, till the max hits a max value say 50000. 
  I wrote the following snippet:</p>
  
  <pre><code>high = 50000
  arr = [0, 1]
  
  while arr.last &lt; high do
    arr.inject{|a, i| arr.push(arr[-2] + arr[-1])}
  end
  
  puts arr.last
  </code></pre>
  
  <p>This causes the program to halt. 
  I am actually new to ruby, Is there a good way to tackle ifs and while with <code>inject</code> in the same statement in ruby?
  What could be a better approach for the above method i am using. </p>