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: responder.rb
    path of file: ./repos/acts_as_api/lib/acts_as_api
    
    the code of the file until where you have to start completion: # frozen_string_literal: true

module ActsAsApi
  # A custom Rails responder class to auto
    
    def display(resource, given_options = {})
      api_template = options[:api_template]

      if api_template.nil? || !resource.respond_to?(:as_api_response)
        controller.render given_options.merge!(options).merge!(format => resource)
      else
        controller.render_for_api api_template, given_options.merge!(options).merge!(format => resource)
      end