<commit_before>module ActiveModel
  class Serializer
    module Associations #:nodoc:
      class Base #:nodoc:
        def initialize(name, options={}, serializer_options={})
          @name = name
          @options = options
          @serializer_options = serializer_options
        end

        def target_serializer
          serializer = options[:serializer]
          serializer.is_a?(String) ? serializer.constantize : serializer
        end

        def key
          options[:key] || @name
        end

        def root
          options[:root] || @name
        end

        def name
          options[:name] || @name
        end

        def object
          options[:value]
        end

        def embed_ids?
          [:id, :ids].include? options[:embed]
        end

        def embed_objects?
          [:object, :objects].include? options[:embed]
        end

        def embed_in_root?
          options[:include]
        end

        def embeddable?
          !object.nil?
        end

        def embed_key
          if key = options[:embed_key]
            key
          else
            :id
          end
        end

      protected

        def find_serializable(object)
          if target_serializer
            target_serializer.new(object, serializer_options)
          elsif object.respond_to?(:active_model_serializer) && (ams = object.active_model_serializer)
            ams.new(object, serializer_options)
          else
            object
          end
        end

        attr_reader :options, :serializer_options
      end

      class HasMany < Base #:nodoc:
        def key
          if key = options[:key]
            key
          elsif embed_ids?
            id_key
          else
            @name
          end
        end

        def id_key
          "#{@name.to_s.singularize}_ids".to_sym
        end
<commit_msg>Use private instead of protected, we don't use explicit receivers<commit_after>module ActiveModel
  class Serializer
    module Associations #:nodoc:
      class Base #:nodoc:
        def initialize(name, options={}, serializer_options={})
          @name = name
          @options = options
          @serializer_options = serializer_options
        end

        def target_serializer
          serializer = options[:serializer]
          serializer.is_a?(String) ? serializer.constantize : serializer
        end

        def key
          options[:key] || @name
        end

        def root
          options[:root] || @name
        end

        def name
          options[:name] || @name
        end

        def object
          options[:value]
        end

        def embed_ids?
          [:id, :ids].include? options[:embed]
        end

        def embed_objects?
          [:object, :objects].include? options[:embed]
        end

        def embed_in_root?
          options[:include]
        end

        def embeddable?
          !object.nil?
        end

        def embed_key
          if key = options[:embed_key]
            key
          else
            :id
          end
        end

        private

        def find_serializable(object)
          if target_serializer
            target_serializer.new(object, serializer_options)
          elsif object.respond_to?(:active_model_serializer) && (ams = object.active_model_serializer)
            ams.new(object, serializer_options)
          else
            object
          end
        end

        attr_reader :options, :serializer_options
      end

      class HasMany < Base #:nodoc:
        def key
          if key = options[:key]
            key
          elsif embed_ids?
            id_key
          else
            @name
          end
        end

        def id_key
          "#{@name.to_s.singularize}_ids".to_sym
        end

{'fraction_non_alphanumeric': 0.07207207207207207, 'fraction_numerical': 0.0, 'mean_word_length': 1.435483870967742, 'pattern_counts': {'":': 0, '<': 5, '<?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': '2639764', 'n_tokens_mistral': 1024, 'n_tokens_neox': 987, 'n_words': 249}