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: literals.rb
    path of file: ./repos/ruby/lib/rdoc/markdown
    
    the code of the file until where you have to start completion: # coding: UTF-8
# frozen_string_literal: true
# :markup: markdown

##
# This set of literals is for Ruby 1.9 regular exp
    
    def position_line_offsets
      unless @position_line_offsets
        @position_line_offsets = []
        total = 0
        string.each_line do |line|
          total += line.size
          @position_line_offsets << total
        end
      end