# File lib/file/tail.rb, line 237
    def tail(n = nil, &block) # :yields: line
      @n = n
      result = []
      array_result = false
      unless block
        block = lambda { |line| result << line }
        array_result = true
      end
      preset_attributes unless @lines
      loop do
        begin
          restat
          read_line(&block)
          redo
        rescue ReopenException => e
          until eof? || @n == 0
            block.call readline
            @n -= 1 if @n
          end
          reopen_file(e.mode)
          @after_reopen.call self if @after_reopen
        rescue ReturnException
          return array_result ? result : nil
        end
      end
    end