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: named_api_resource.rb
    path of file: ./repos/poke-api-v2/lib/poke_api
    
    the code of the file until where you have to start completion: module PokeApi
  # Base class with share
    
    def assign_object(klass, data, key)
      return unless data

      assignment = if data.is_a? Array
                     assign_list(klass: klass, data: data)
                   else
                     klass.new(data)
                   end