replaces Pathname#(dirname|realpath) with File.$1

Simpler, thanks to @rubys for the hint.