Well the simplest error is the count.inject{| ... |} part. The stuff
that goes between the | ... | are variable declarations. For example
this is sum for an array

array = [1,2,1,1]
array.inject(0){|x, y| x + y} => 5

note the variable 'x' and 'y' are between the | ... | and the action
'x + y' takes place after. inject is expecting two variable to be
declared so that is another error.