<commit_before>class User < ActiveRecord::Base
  has_many :spaces
  has_one :account, dependent: :destroy

  has_many :memberships, class_name: 'UserOrganizationMembership', dependent: :destroy
  has_many :organizations, through: :memberships

  after_create :create_account

  validates_presence_of :username
  validates_presence_of :name
  validates :email, presence: true, format: /@/
  validates :auth0_id, presence: true, uniqueness: true

  enum plan: Plan.as_enum

  def plan_details
    Plan.find(plan)
  end

  def member_of?(organization_id)
    memberships.for_organization(organization_id).any?
  end

  def domain_name
    email[/@(?<domain>.*).com/,"domain"]<commit_msg>Generalizing domain name regex to support .net, .co, etc.<commit_after>class User < ActiveRecord::Base
  has_many :spaces
  has_one :account, dependent: :destroy

  has_many :memberships, class_name: 'UserOrganizationMembership', dependent: :destroy
  has_many :organizations, through: :memberships

  after_create :create_account

  validates_presence_of :username
  validates_presence_of :name
  validates :email, presence: true, format: /@/
  validates :auth0_id, presence: true, uniqueness: true

  enum plan: Plan.as_enum

  def plan_details
    Plan.find(plan)
  end

  def member_of?(organization_id)
    memberships.for_organization(organization_id).any?
  end

  def domain_name
    email[/@(?<domain>[^\.]*).(.*)/,"domain"]
{'fraction_non_alphanumeric': 0.10515172900494002, 'fraction_numerical': 0.0014114326040931546, 'mean_word_length': 5.05982905982906, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 5, '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': '1258137', 'n_tokens_mistral': 478, 'n_tokens_neox': 445, 'n_words': 107}