Without loops, it's very nice!

On Oct 25, 11:50    ߮
> luisbebop wrote:
> > I did a single line of code in Ruby, which joins all text files in a
> > folder to a bigfile. I got some tests, and it's works!
> > Does anyone knows a better way, or other 'Ruby Way' to do that ?
>
> > File.open('bigfile','w') { |mergedFile| Dir.glob("*.txt").each { |
> > file| File.readlines(file).each { |line| mergedFile << line } } }
>
> "We don't need no stinkin' loops!"
>
> ruby -e"puts ARGF.to_a" *.txt >merged
>
> "We still don't need no stinkin' loops!"
>
> File.open("mrg","w"){|f|f.puts Dir['*.txt'].map{|nm|IO.read nm}}