nums.inject &:'+'
&: takes the ... and calls to proc which is a callable object. with the provided arguments... the result is that you can take a method name on one of the array objects (like +) and ...do it.
1.send '+', 2
Assuming that you've assigned nums[] to hold the data you're dealing with, then puts nums.inject(0) {|a, b| a + b} will get you the answer 9and then you just take the first ten digits)
A much less elegant way to do this is
sum = 0
for i in 0..nums.size-1
sum = sum + nums[i]
end
puts sum
Once you understand what the notation does, it's an elegant way of doing it. But the uneducated will be extremely confused. There is all sorts of evil to it.