uniq
takes a block in later versions of ruby but as you also need the count I would start looking into the group_by
method:
result = hash.group_by{|x| x.values_at(:firstname, :lastname, :nickname)}
Then it is just a matter of grabbing a hash and adding the number of values:
result.map{|_,values| values.first.merge {size: values.lenth}}