Allow use with Ruby 1.8.x

Ruby 1.8 doesn't have #each_with_object on Enumerable.

Using #inject instead.