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: array.rb
    path of file: ./repos/libraries.io/config/initializers
    
    the code of the file until where you have to start completion: # frozen_string_literal: false

class Array
  # Generates a single quoted postgres array string format. This is the form
    
  def to_postgres_array(omit_quotes: false)
    result = "#{omit_quotes ? '' : "'"}{"

    result << collect do |value|
      case value
      when Array
        value.to_postgres_array(omit_quotes: true)
      when String
        value = value.gsub(/\\/, '\&\&')
        value = value.gsub(/'/, "''")
        value = value.gsub(/"/, '\"')
        value = "\"#{value}\""
        value
      when NilClass
        "NULL"
      else
        value
      end
    end.join(",")

    result << "}#{omit_quotes ? '' : "'"}"
  end