<commit_before>require_relative '02_searchable'
require 'active_support/inflector'

# Phase IIIa
class AssocOptions
  attr_accessor(
    :foreign_key,
    :class_name,
    :primary_key
  )

  def model_class
    # ...
  end

  def table_name
    # ...
  end
end

class BelongsToOptions < AssocOptions
  def initialize(name, options = {})
    self.class_name = name.to_s.camelcase
    self.foreign_key = (name.to_s.underscore + "_id").to_sym
    self.primary_key = "id".to_sym

    options.each do |option, value|
      self.send("#{option}=", value)
    end
  end
end

class HasManyOptions < AssocOptions
  def initialize(name, self_class_name, options = {})
    self.class_name = self_class_name # .to_s.camelcase
    self.foreign_key = (name.to_s.underscore + "_id").to_sym
    self.primary_key = "id".to_sym

    options.each do |option, value|
      self.send("#{option}=", value)
    end
  end
end

module Associatable
  # Phase IIIb<commit_msg>Finish HasManyOptions class<commit_after>require_relative '02_searchable'
require 'active_support/inflector'

# Phase IIIa
class AssocOptions
  attr_accessor(
    :foreign_key,
    :class_name,
    :primary_key
  )

  def model_class
    # ...
  end

  def table_name
    # ...
  end
end

class BelongsToOptions < AssocOptions
  def initialize(name, options = {})
    self.class_name = name.camelcase
    self.foreign_key = (name.underscore + "_id").to_sym
    self.primary_key = "id".to_sym

    options.each do |option, value|
      self.send("#{option}=", value)
    end
  end
end

class HasManyOptions < AssocOptions
  def initialize(name, self_class_name, options = {})
    self.class_name = name.singularize.camelcase
    self.foreign_key = (self_class_name.underscore + "_id").to_sym
    self.primary_key = "id".to_sym

    options.each do |option, value|
      self.send("#{option}=", value)
    end
  end
end

module Associatable
  # Phase IIIb
{'fraction_non_alphanumeric': 0.11035207566999475, 'fraction_numerical': 0.0021019442984760903, 'mean_word_length': 3.327272727272727, 'pattern_counts': {'":': 0, '<': 7, '<?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': '4701754', 'n_tokens_mistral': 675, 'n_tokens_neox': 662, 'n_words': 138}