def children(with_directory = true)
      with_directory = false if @path == '.'
      result = []
      Dir.foreach(@path) do |e|
        next if ['.', '..'].include?(e)
        result <<
          if with_directory
            self.class.new(File.join(@path, e))
          else
            self.class.new(e)
          end
      end
      result
    end
def children(with_directory = true)
      with_directory = false if @path == '.'
      result = []
      Dir.foreach(@path) do |e|
        next if ['.', '..'].include?(e)
        result <<
          if with_directory
            self.class.new(File.join(@path, e))
          else
            self.class.new(e)
          end
      end
      result
    end
Returns the children of the directory (files and subdirectories, not
 recursive) as an array of Pathname objects.  By default, the returned
 pathnames will have enough information to access the files.  If you set
 +with_directory+ to +false+, then the returned
 pathnames will contain the
 filename only.

 For example:
   pn = Pathname("/usr/lib/ruby/1.8")
   pn.children
     # -> [ Pathname:/usr/lib/ruby/1.8/English.rb,
            Pathname:/usr/lib/ruby/1.8/Env.rb,
            Pathname:/usr/lib/ruby/1.8/abbrev.rb, ... ]
   pn.children(false)
     # -> [ Pathname:English.rb,
            Pathname:Env.rb,
            Pathname:abbrev.rb, ... ]

 Note that the result never contain the entries
 <tt>.</tt> and <tt>..</tt> in
 the directory because they are not children.

 This method has existed since 1.8.1.