The razors can be dangerous, so treatment should begin with a trip to your veterinarian to rule out any possible medical problems. Once these are ruled out, the next step is to identify the cause of the behavior. The behavior may be the result of anxiety. Once determined, remove or correct the cause, in this case remove the cause of the anxiety. Punishment should not be used to 'treat the problem.'
In fact, punishment often times is a contributing factor and will only make matters worse. Diversion is a good alternative, replacing the odd behavior with something more pleasant.
Since this is a 'metal' object it seems that there could be a viatmin defiency in the dogs food.
Review your dogs diet, and be sure it is a high quality kibble in the very least. Add some 'treats' to a buster cube, or kong treat toy to occupy your dogs mind.