I would put this in the core_ext folder for hash.rb in lib folder.