Not really about inject specifically...  just attempting another way

a = [1,1,1,2,2,2,2,3,4,4,4,4]

a.zip([0] + a).map { |i, j| i - j }.inject([]) do |s, k|
    k.zero? ? s[0...-1] + [s[-1] + 1] : s << k
end