Working with Ruby
Hi, I am Jan. This is my old Ruby blog. I still post about Ruby, but I now do it on idiosyncratic-ruby.com. You should also install Irbtools to improve your IRB.

NoTabs

After editing some source files with different editors on different platforms, I had some troubles with automatically inserted tabs messing it all up.

This little script replaces all tabs with two spaces.

 1
$*.each{|a|b=File.read a;File.open(a,'w'){|c|c.print b.gsub'	','  '}}
CC0

payload | December 09, 2009

i would recommend that you put "\t" in instead of using tab again ^^ this script would break itself if you apply it to itself

J-_-L | December 10, 2009

Yes, you are right.. but:
I don't think, that it matters. If you know, that you have tabs in the code of the file which is checked (which is usually not that often), then you will probably know, that these will also get replaced ;)