When I need to work with files in a given directory, I always resort to the following way, which to my opinion is cumbersome:
this_dir = Dir.pwd filep