<commit_before>module IgnoreDefaultScope
  class Relation
    attr_reader :host, :name, :id

    def initialize(args)
      @host = args[:host]
      @name = args[:name]
      @id = host_attribute("_id").call()
    end

    def klass
      klass = polymorphic? ? polymorphic_type : association_klass
    end

    def id_changed?
      host_attribute("_id_changed?").call()
    end

    private
    def host_attribute(message_suffix)
      host.method(attribute_name(message_suffix))
    end

    def attribute_name(message_suffix)
      (name.to_s + message_suffix).to_sym
    end

    def reflection
      host.class.reflect_on_association(name)
    end

    def polymorphic?
      reflection.options[:polymorphic]
    end

    def polymorphic_type
      host_attribute("_type").call.constantize
    end

    def association_klass
      host.class.reflect_on_association(name).class_name.constantize
    end
  end
end<commit_msg>Applied extract-method refactoring to relation.association_klass method<commit_after>module IgnoreDefaultScope
  class Relation
    attr_reader :host, :name, :id

    def initialize(args)
      @host = args[:host]
      @name = args[:name]
      @id = host_attribute("_id").call()
    end

    def klass
      klass = polymorphic? ? polymorphic_type : association_klass
    end

    def id_changed?
      host_attribute("_id_changed?").call()
    end

    private
    def host_attribute(message_suffix)
      host.method(attribute_name(message_suffix))
    end

    def attribute_name(message_suffix)
      (name.to_s + message_suffix).to_sym
    end

    def reflection
      host.class.reflect_on_association(name)
    end

    def polymorphic?
      reflection.options[:polymorphic]
    end

    def polymorphic_type
      host_attribute("_type").call.constantize
    end

    def association_klass
      reflection.class_name.constantize
    end
  end
end
{'fraction_non_alphanumeric': 0.08046585494970884, 'fraction_numerical': 0.0, 'mean_word_length': 2.9705882352941178, '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': '1541394', 'n_tokens_mistral': 609, 'n_tokens_neox': 567, 'n_words': 116}