Need to create a Hash using user input in Ruby
<p>The goal is to get the user to enter 3 separate numbers and have the script store those in a Hash, output the values, and then add all the numbers in the hash.  The script I'm working on keeps erroring out, and I was hoping for some guidance on how to correct it.</p>

<pre><code>#!/user/bin/ruby
userhash=Hash.new()
puts "Enter first number"
userhash=[:num1=&gt;gets.chomp]
puts "Enter second number"
userhash=[:num2=&gt;gets.chomp]
puts "Enter third number"
userhash=[:num3=&gt;gets.chomp]
puts "The numbers entered were"
userhash.each_value {|value| puts value}
puts "the sum is #{userhash.inject(:+)}"
</code></pre>

<p>I just finished doing this as an array with no issues and thought that doing it as a hash would be quite similar.  Obviously it's not working as intended.  Help is appreciated.</p>

<pre><code>Error: rb:15:in '&lt;main&gt;': undefined method 'each_value' for [{:num3=&gt;"3"}]:Array (NoMethodError)
</code></pre>

<p>I entered values 1, 2, 3 when prompted to test.</p>

<p>UDPATE: Orde's method got helped me get this to work</p>

<pre><code>#!/user/bin/ruby
userhash=Hash.new()
puts "Enter first number"
userhash[:num1]=gets.chomp.to_f
puts "Enter 2nd number"
userhash[:num2]=gets.chomp.to_f
puts "Enter 3rd number"
userhash[:num3]=gets.chomp.to_f
puts "The number you entered were "
userhash.each_value {|value| puts value}
puts "The sum of those number is #{userhash.each_value.inject(:+)}"
</code></pre>