<commit_before>Spree.user_class.class_eval do
  def generate_api_key!
    self.api_key = SecureRandom.hex(24)
    save!
  end

  def clear_api_key!
    self.api_key = nil
    save!
  end
end<commit_msg>[api] Add roles association and override for has_spree_role? method to User decorator<commit_after>Spree.user_class.class_eval do
  has_and_belongs_to_many :roles, :join_table => 'spree_roles_users'

  def generate_api_key!
    self.api_key = SecureRandom.hex(24)
    save!
  end

  def clear_api_key!
    self.api_key = nil
    save!
  end

  # has_spree_role? simply needs to return true or false whether a user has a role or not.
  def has_spree_role?(role_in_question)
    roles.any? { |role| role.name == role_in_question.to_s }
  end
end
{'fraction_non_alphanumeric': 0.07785234899328859, 'fraction_numerical': 0.005369127516778523, 'mean_word_length': 3.844155844155844, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 4, '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': '5277037', 'n_tokens_mistral': 282, 'n_tokens_neox': 274, 'n_words': 67}