Remove extra white-spaces using zsh function

I want to remove easily extra white-spaces and tabs from source codes.
There are a lot of samples using shell scirpts, and I write a tiny script using a zsh function.

I utilize this sample (In Japanese).

funciton rw() {
  for i
  do
    mv $i $i.tmp
    sed -e 's/[[:blank:]]*$//' $i.tmp > $i
    rm $i.tmp
  done
}

This function should be written in your .zshrc file.

To use this script, only you have to do is to type like this.

rw /path/to/*.rb

References