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: resource.rb
    path of file: ./repos/trestle/lib/trestle
    
    the code of the file until where you have to start completion: module Trestle
  class Resource < Admin
    require_relative "resource/adapter_methods"
    require_relative "resource/builder"
    require_relative "resource/collection"
    require_relative "resource/toolbar"


    
      def routes
        admin = self

        resource_method  = singular? ? :resource : :resources
        resource_name    = admin_name
        resource_options = {
          controller: controller_namespace,
          as:         route_name,
          path:       options[:path],
          except:     (RESOURCE_ACTIONS - actions)
        }

        Proc.new do
          public_send(resource_method, resource_name, resource_options) do
            admin.additional_routes.each do |block|
              instance_exec(&block)
            end
          end
        end
      end