Created
July 8, 2014 04:22
-
-
Save Sixeight/f0c5a865672d1e8afa9d to your computer and use it in GitHub Desktop.
delete trailing white space
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Dir["app/**/*.rb"].each do |file| | |
File.open(file, "rb+") do |io| | |
result = [] | |
body = io.read | |
body.split("\n").each do |line| | |
line.gsub!(/\s+\z/, "") | |
result << line | |
puts line | |
end | |
io.rewind | |
io.write result.join("\n") | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment