I've been learning ruby by solving project euler problems and in one solution to a problem I saw you could do something like "12341".chars.inject(1) { |prod, n| prod * n.to_i }
.
I've looked on the ruby doc but I can't find where String#chars
is defined.
Can anyone explain how that works?