Working with Ruby
Occasional blog posts about Ruby updates, tools, editor tweaks, and random snippets. You might also be interested in my newer project that docuements lesser-known features in Ruby: Idiosyncratic Ruby.


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.

$*.each{|a| a;,'w'){|c|c.print b.gsub'	','  '}}

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 ;)