def new(options)
      if options.has_key? :directory
        dir = self[options.delete(:directory)]
        FileUtils.mkdir_p dir.path
      else
        file = self[options.delete(:file)]
        if (binary_content = options.delete(:with_binary_content) || options.delete(:with_binary_contents))
          file.binary_content = binary_content
        else
          file.content = (options.delete(:with_content) || options.delete(:with_contents) || '')
        end
      end

      raise "unexpected keys '#{options.keys.join(', ')}'" unless options.empty?

      dir || file
    end
def new(options)
      if options.has_key? :directory
        dir = self[options.delete(:directory)]
        FileUtils.mkdir_p dir.path
      else
        file = self[options.delete(:file)]
        if (binary_content = options.delete(:with_binary_content) || options.delete(:with_binary_contents))
          file.binary_content = binary_content
        else
          file.content = (options.delete(:with_content) || options.delete(:with_contents) || '')
        end
      end

      raise "unexpected keys '#{options.keys.join(', ')}'" unless options.empty?

      dir || file
    end
usage new :file=>'my file.rb', :with_contents=>'some stuff'