The documentation is using File.directory?(“/path/to/directory”), but the method being referred to is Dir.exists?(). Dir . exists? (" . ") => true The source code is the same as File.directory?().
Full article: http://apidock.com/ruby/Dir/exists%3F/class#1288-Dir