<commit_before># == Schema Information
#
# Table name: core_settings
#
#  id          :integer          not null, primary key
#  domain_id   :integer          not null
#  section     :string(255)      default(""), not null
#  key         :string(255)      not null
#  value       :string(255)      not null
#  value_type  :string(255)      default(""), not null
#  description :text(65535)
#  created_at  :datetime
#  updated_at  :datetime
#

class Setting < ActiveRecord::Base
  self.table_name = 'core_settings'
  belongs_to :domain
  validates_presence_of :section, :key, :value, :value_type
  validates_uniqueness_of :key, scope: [:domain_id, :section]
  
  def to_s
    value
  end
  
  def cache_key
    "setting:#{domain_id}:#{section}:#{key}"
  end
end<commit_msg>Setting.get method<commit_after># == Schema Information
#
# Table name: core_settings
#
#  id          :integer          not null, primary key
#  domain_id   :integer          not null
#  section     :string(255)      default(""), not null
#  key         :string(255)      not null
#  value       :string(255)      not null
#  value_type  :string(255)      default(""), not null
#  description :text(65535)
#  created_at  :datetime
#  updated_at  :datetime
#

class Setting < ActiveRecord::Base
  self.table_name = 'core_settings'
  belongs_to :domain
  validates_presence_of :section, :key, :value, :value_type
  validates_uniqueness_of :key, scope: [:domain_id, :section]
  
  def to_s
    value
  end
  
  def cache_key
    "setting:#{domain_id}:#{section}:#{key}"
  end
  
  def self.get(section, key)
    s = Setting.find_by(section: section, key: key)
    
    return nil if s.nil?
    return s.value.to_i if s.value_type == "number"
    s.value
  end
end
{'fraction_non_alphanumeric': 0.11309867282169649, 'fraction_numerical': 0.019619157530294286, 'mean_word_length': 2.9142212189616252, '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': '3787636', 'n_tokens_mistral': 610, 'n_tokens_neox': 593, 'n_words': 151}