Rewriting the inject method for the Array class in Ruby.