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

module JekyllAdmin
  class Server < Sinatra::Base
    namespace "/collections" do
      get do
        json(site.collec
    
      def entries
        collections_dir = site.config["collections_dir"]
        collection_id, splats = params.values_at("collection_id", "splat")
        args = {
          :base         => site.in_source_dir(collections_dir, "_#{collection_id}"),
          :content_type => collection_id,
          :splat        => splats&.first,
        }
        # get the directories inside the requested directory
        directory = JekyllAdmin::Directory.new(directory_path, **args)
        directories = directory.directories
        # merge directories with the documents at the same level
        directories.concat(directory_docs.sort_by(&:date).reverse)
      end
    end