<commit_before>module Referrals
  module CookiesConcern
    extend ActiveSupport::Concern

    included do
      before_action :handle_pid
    end

    private

    def handle_pid
      # @todo - make configurable name of parameter
      # @todo - make configurable override partner id
      if params[:pid] && !cookies[:referrals_pid] && partner
        cookies[:referrals_pid] = {
            value: partner.id,
            expires: 1.year.from_now #@todo -make configurable
        }
      end
    end

    def partner
      @partner ||= Referrals::Partner.find_by_id(params[:pid])
    end
  end
end<commit_msg>Code optimization - remove looking by reflection<commit_after>module Referrals
  module CookiesConcern
    extend ActiveSupport::Concern

    included do
      before_action :handle_pid
    end

    private

    def handle_pid
      # @todo - make configurable name of parameter
      # @todo - make configurable override partner id
      if params[:pid] && !cookies[:referrals_pid] && partner
        cookies[:referrals_pid] = {
            value: partner.id,
            expires: 1.year.from_now #@todo -make configurable
        }
      end
    end

    def partner
      @partner ||= Referrals::Partner.find_by(id: params[:pid])
    end
  end
end
{'fraction_non_alphanumeric': 0.08069620253164557, 'fraction_numerical': 0.0015822784810126582, 'mean_word_length': 2.446866485013624, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4735392', 'n_tokens_mistral': 387, 'n_tokens_neox': 364, 'n_words': 99}