1945ab4cdb87eaf5a5c906fa884c29f1

My first Ruby script. I'm curious how to improve it.

Funnily enough, I was stymied by the while/for syntax. So, I used the more functional style.

#!/usr/bin/env ruby

files = ARGV.collect { |fname| File.new(fname, 'w') }
$stdin.each { |line| files[rand(files.length)].puts line }

Refactorings

No refactoring yet !

3dbfaab45e1a50be837ebf724b116338

Gabby

November 24, 2011, November 24, 2011 04:42, permalink

No rating. Login to rate!

Holy cnocsie data batman. Lol!

ERROR_BAD_DUPLICATES
3dbfaab45e1a50be837ebf724b116338

Gabby

November 24, 2011, November 24, 2011 04:42, permalink

No rating. Login to rate!

Holy cnocsie data batman. Lol!

ERROR_BAD_DUPLICATES

Your refactoring





Format Copy from initial code

or Cancel