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: apply.rb
    path of file: ./repos/facets/work/consider/core/enumerable
    
    the code of the file until where you have to start completion: module Enumerable

  def apply(*method_names)
    self.collect do |item|
      method_names.each do |method_name|
        if item.kind_of?(Hash) and (['id', :id].include?(method_name) or not item.respond
    
  def apply(*method_names)
    self.collect do |item|
      method_names.each do |method_name|
        if item.kind_of?(Hash) and (['id', :id].include?(method_name) or not item.respond_to?(method_name))
          item = item[method_name]
        else
          item = item.send(method_name)
        end
      end
      item
    end