def file(name, mode = 33188, &content)
      content ||= NO_CONTENT

      name_parts = name.split(::File::SEPARATOR)

      file_name = name_parts.pop

      if name_parts.empty?
        File.new(name, mode, content).tap do |file|
          add_file(file)
        end
      else
        dir(name_parts.join(::File::SEPARATOR)) do |parent|
          parent.file(file_name, mode, &content)
        end
      end
    end
def file(name, mode = 33188, &content)
      content ||= NO_CONTENT

      name_parts = name.split(::File::SEPARATOR)

      file_name = name_parts.pop

      if name_parts.empty?
        File.new(name, mode, content).tap do |file|
          add_file(file)
        end
      else
        dir(name_parts.join(::File::SEPARATOR)) do |parent|
          parent.file(file_name, mode, &content)
        end
      end
    end
Add a +File+ named +name+ to this entity's list of children. The +name+
 may simply be the name of the file or may be a path to the file.

 In the case of the latter, +file+ will create the +Directory+ tree
 which contains the +File+ specified by the path.

 Either way, the +File+'s contents will be set to the result of the
 given block, or to a blank string if no block is given

 @example
   archive = Directory.new
   archive.file('README') do
     "Cool"
   end

 @example
   archive = Directory.new
   archive.file('app/models/user.rb') do
     "class User < ActiveRecord::Base\nend"
   end

 @param name [String] the file name
 @param mode [Fixnum] the file mode

 @yieldreturn [String] the file contents