Last Updated: February 25, 2016
·
906
· divoxx

Convert old ruby hash syntax to the new one

find . -type f -iname '*.rb' | xargs ruby -i -pe 'gsub(/(?<!:):(\w+)\s*=>\s*/, "\\1: ")'

Keep in mind it won't work for hashes that you have mixed keys.