Skip to content

Instantly share code, notes, and snippets.

@jurgens
Created September 14, 2012 10:07
Show Gist options
  • Save jurgens/3721147 to your computer and use it in GitHub Desktop.
Save jurgens/3721147 to your computer and use it in GitHub Desktop.
convert to 1.9 hash syntax
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 } }
@dpsk
Copy link

dpsk commented Sep 18, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment