<commit_before>require 'active_support/inflector/inflections'

module Neo4j
  module ActiveNode
    module HasN
      class Association
        include Neo4j::Shared::RelTypeConverters
        include Neo4j::ActiveNode::Dependent::AssociationMethods
        attr_reader :type, :name, :relationship, :direction, :dependent

        def initialize(type, direction, name, options = {type: nil})
          validate_init_arguments(type, direction, name, options)
          @type = type.to_sym
          @name = name
          @direction = direction.to_sym
          @target_class_name_from_name = name.to_s.classify
          apply_vars_from_options(options)
        end

        def derive_model_class
          return @model_class unless @model_class.nil?

          return nil if relationship_class.nil?
          # TODO: change `#_to_class` to `#to_class` when #837 is merged
          return false if relationship_class._to_class.to_s.to_sym == :any
          relationship_class._to_class
        end

        def target_class_option(model_class)
          case model_class
          when nil
            if @target_class_name_from_name
              "#{association_model_namespace}::#{@target_class_name_from_name}"
            else<commit_msg>Using `#to_name` instead of `#_to_name` now that #837 has been merged<commit_after>require 'active_support/inflector/inflections'

module Neo4j
  module ActiveNode
    module HasN
      class Association
        include Neo4j::Shared::RelTypeConverters
        include Neo4j::ActiveNode::Dependent::AssociationMethods
        attr_reader :type, :name, :relationship, :direction, :dependent

        def initialize(type, direction, name, options = {type: nil})
          validate_init_arguments(type, direction, name, options)
          @type = type.to_sym
          @name = name
          @direction = direction.to_sym
          @target_class_name_from_name = name.to_s.classify
          apply_vars_from_options(options)
        end

        def derive_model_class
          return @model_class unless @model_class.nil?

          return nil if relationship_class.nil?
          return false if relationship_class.to_class.to_s.to_sym == :any
          relationship_class.to_class
        end

        def target_class_option(model_class)
          case model_class
          when nil
            if @target_class_name_from_name
              "#{association_model_namespace}::#{@target_class_name_from_name}"
            else
{'fraction_non_alphanumeric': 0.07203561311210037, 'fraction_numerical': 0.004856333468231485, 'mean_word_length': 2.6406480117820323, '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': '401463', 'n_tokens_mistral': 702, 'n_tokens_neox': 687, 'n_words': 154}