domenica, aprile 15, 2007

 

Ruby: lista + stampa file ruby nella directory corrente

Elenca tutti i .rb presenti nella directory corrente stampandoli a video


Dir.foreach(".") { |f|
if ( f !~ /^\./ && f !~ /\~$/ && f =~ /\.rb$/)
printf("-- %s --\n",f)
for r in File.new(f,'r').readlines do
printf("%s\n",r.chomp)
end
printf("-- %s --\n\n",f)
end
}

Etichette: , ,


Commenti: Posta un commento

Iscriviti a Commenti sul post [Atom]





<< Home page

This page is powered by Blogger. Isn't yours?

Iscriviti a Post [Atom]