Fixes #1154. Pathname.new(Dir.new('dir_name')) raises a TypeError (Dir missing to_path)