I was trying to get familiarize myself with matrices in Ruby. I am trying to initialize a matrix with a input in string format. I tried the following code, but its not working. Please help me what I'm doing wrong.
input =
'08 02 22 97
49 49 99 40
81 49 31 73
52 70 95 23'
x = Matrix.rows(input.lines() { |substr| substr.strip.split(//) })
puts x[0,0] #I expect 8. but I am getting 48 which is not even in the matrix
I guess I am not initializing the matrix properly. Please help me.