Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Ticket #2814: generator.patch

File generator.patch, 1.0 kB (added by François Beausoleil <francois.beausoleil@gmail.com>, 3 years ago)

Compact the array before flattening and passing to Hash.new

  • railties/lib/rails_generator/options.rb

    old new  
    127127          opt.on('-q', '--quiet', 'Suppress normal output.') { |options[:quiet]| } 
    128128          opt.on('-t', '--backtrace', 'Debugging: show backtrace on errors.') { |options[:backtrace]| } 
    129129          opt.on('-h', '--help', 'Show this help message.') { |options[:help]| } 
    130           opt.on('-c', '--svn', 'Modify files with subversion. (Note: svn must be in path)') { options[:svn] = Hash[*`svn status`.collect { |e| e.chop.split.reverse unless e.chop.split.size != 2 }.flatten] } 
     130          opt.on('-c', '--svn', 'Modify files with subversion. (Note: svn must be in path)') { options[:svn] = Hash[*`svn status`.collect { |e| e.chop.split.reverse unless e.chop.split.size != 2 }.compact.flatten] } 
    131131        end 
    132132 
    133133    end