Created
September 14, 2012 10:07
-
-
Save jurgens/3721147 to your computer and use it in GitHub Desktop.
convert to 1.9 hash syntax
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Dir['**/*.rb'].each { |f| | |
s = open(f).read | |
awesome_rx = /(?<!return)(?<!:)(?<!\w)(\s+):(\w+)\s*=>/ | |
count = s.scan(awesome_rx).length | |
next if count.zero? | |
s.gsub!(awesome_rx, '\1\2:') | |
puts "#{count} replacements @ #{f}" | |
open(f, 'w') { |b| b << s } } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
http://devign.me/convert-ruby-hash-syntax-to-1-9/