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: params.rb
    path of file: ./repos/workarea/core/app/models/workarea/configuration
    
    the code of the file until where you have to start completion: module Workarea
  module Configuration
    class Params
      def initialize(params)
        @params = params
      end

      def to_h
        Admin.definition.fields.each_with_object({}) do |fiel
    
      def to_h
        Admin.definition.fields.each_with_object({}) do |field, memo|
          next unless @params.key?(field.key)
          value = @params[field.key]

          formatted_value =
            if value.present? && respond_to?(field.type)
              send(field.type, field, value)
            else
              value
            end

          memo[field.key] = if field.required?
            formatted_value.presence || field.default
          else
            formatted_value || field.default
          end