You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: visit.rb
    path of file: ./repos/facets/lib/standard/facets/pathname
    
    the code of the file until where you have to start completion: class Pathname

  # Recursively visit a directory located by its path, yielding each resource
  # as its full matching pathname object. If called on a file, yield the file.
  #
  # call-seq:
  #   visit => yield each file
  #   visit(all: true) => yield visited directories as well
  #   visit(hidden: true) => yield hidden files and directories as well
  #
  # Examples
  #
  #     # Locate any file but *.haml within app/**
    
  def visit(options = {:all => false, :hidden => false})
    if self.directory?
      children.each do |entry|
        next if entry.basename.to_s[0] == "." && !options[:hidden]
        yield(entry) unless entry.directory? && !options[:all]
        ##entry.visit(:all => options[:all]) { |sub_entry| yield sub_entry } if entry.directory?
        entry.visit(:all => options[:all], :hidden => options[:hidden]) do |sub_entry|
          yield(sub_entry)
        end if entry.directory?
      end
    else
      yield self
    end
  end