Skip to content

Instantly share code, notes, and snippets.

@Sixeight

Sixeight/wanco.rb

Created Jul 8, 2014
Embed
What would you like to do?
delete trailing white space
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