public Method

BlueCloth.detab!( tabwidth=TabWidth )

Convert tabs to spaces in place and return self if any were converted.

Source Code

# File bluecloth.rb, line 224
def detab!( tabwidth=TabWidth )
        newstr = self.split( /\n/ ).collect {|line|
                line.gsub( /(.*?)\t/ ) do
                        $1 + ' ' * (tabwidth - $1.length % tabwidth)
                end
        }.join("\n")
        self.replace( newstr )
end
Comments

Have your say
Please use Textile formatting (click here for a cheat sheet). Use <code/> and <pre/> for code samples.
Click here to login with OpenID to to post comments.