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: pdf_public.rb
    path of file: ./repos/combine_pdf/lib/combine_pdf
    
    the code of the file until where you have to start completion: # -*- encoding : utf-8 -*-
########
    
    def number_pages(options = {})
      opt = {
        number_format: ' - %s - ',
        start_at: 1,
        font: :Helvetica,
        margin_from_height: 45,
        margin_from_side: 15
      }
      opt.update options
      opt[:location] ||= opt[:number_location] ||= opt[:stamp_location] ||= [:top, :bottom]
      opt[:location] = [opt[:location]] unless opt[:location].is_a? Array

      page_number = opt[:start_at]
      format_repeater = opt[:number_format].count('%')
      just_center = [:center]
      small_font_size = opt[:font_size] || 12

      # some common computations can be done only once.
      from_height = opt[:margin_from_height]
      from_side = opt[:margin_from_side]
      left_position = from_side

      (opt[:page_range] ? pages[opt[:page_range]] : pages).each do |page|
        # Get page dimensions
        mediabox = page[:CropBox] || page[:MediaBox] || [0, 0, 595.3, 841.9]
        # set stamp text
        text = opt[:number_format] % (Array.new(format_repeater) { page_number })
        if opt[:location].include? :center
          add_opt = {}
          if opt[:margin_from_height] && !opt[:height] && !opt[:y]
            add_opt[:height] = mediabox[3] - mediabox[1] - (2 * opt[:margin_from_height].to_f)
            add_opt[:y] = opt[:margin_from_height]
          end
          if opt[:margin_from_side] && !opt[:width] && !opt[:x]
            add_opt[:width] = mediabox[2] - mediabox[0] - (2 * opt[:margin_from_side].to_f)
            add_opt[:x] = opt[:margin_from_side]
          end
          page.textbox text, opt.merge(add_opt)
        end