Sha256: 648311a1ec44971b45d8cade39fbda856aad443502be19c767ffe39ac4dd1c23

Contents?: true

Size: 631 Bytes

Versions: 3

Compression:

Stored size: 631 Bytes

Contents

#!/usr/bin/env ruby
# Author::    Nicolas Pouillard  <ertai@lrde.epita.fr>.
# Copyright:: Copyright (c) 2005 Uttk team. All rights reserved.
# License::   LGPL
# $Id: /fey/uttk/trunk/misc/expandtab.rb 8784 2005-09-26T12:11:55.049358Z ertai  $

class String
  def process!
    chomp!
    gsub!(/\t/, '        ')
    self
  end
end

if ARGV.empty?
  STDIN.each do |line|
    puts line.process!
  end
else
  ARGV.each do |file|
    puts "Processing: #{file}..."
    File.open("#{file}.tmp", 'w') do |tmp|
      IO.foreach(file) do |line|
        tmp.puts line.process!
      end
    end
    File.rename("#{file}.tmp", file)
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
uttk-0.3.5.0 misc/expandtab.rb
uttk-0.3.1.2 misc/expandtab.rb
uttk-0.3.6.1 misc/expandtab.rb