Created
          December 13, 2011 07:44 
        
      - 
      
- 
        Save elado/1471108 to your computer and use it in GitHub Desktop. 
    Convert Entire Ruby Project Hash Syntax to 1.9 ( :sym => value to sym: value )
  
        
  
    
      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', '**/*.rake'].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-file-hash-syntax-to-1-9/