<commit_before># frozen_string_literal: true
require 'singleton'
class Settings
  attr_accessor :settings

  include Singleton

  class << self
    def respond_to?(method, include_private = false)
      super or instance.respond_to?(method, include_private)
    end

    protected

    def method_missing(method, *args, &block)
      return super unless instance.respond_to?(method)
      instance.send(method, *args, &block)
    end
  end

  def initialize
    filename    = File.join(File.dirname(__FILE__), *%W[.. settings #{Rails.env}.yml])
    @settings   = YAML.load(eval(ERB.new(File.read(filename)).src, nil, filename))
  end

  def respond_to?(method, include_private = false)
    super or is_settings_query_method?(method) or @settings.key?(setting_key_for(method))
  end

  protected

  def method_missing(method, *args, &block)
    setting_key    = setting_key_for(method)
    setting_exists = @settings.key?(setting_key)

    if is_settings_query_method?(method)
      setting_exists
    elsif setting_exists
      @settings[setting_key]
    else
      super<commit_msg>Use keyword arguments for boolean with default value<commit_after># frozen_string_literal: true
require 'singleton'
class Settings
  attr_accessor :settings

  include Singleton

  class << self
    def respond_to?(method, include_private: false)
      super or instance.respond_to?(method, include_private)
    end

    protected

    def method_missing(method, *args, &block)
      return super unless instance.respond_to?(method)
      instance.send(method, *args, &block)
    end
  end

  def initialize
    filename    = File.join(File.dirname(__FILE__), *%W[.. settings #{Rails.env}.yml])
    @settings   = YAML.load(eval(ERB.new(File.read(filename)).src, nil, filename))
  end

  def respond_to?(method, include_private: false)
    super or is_settings_query_method?(method) or @settings.key?(setting_key_for(method))
  end

  protected

  def method_missing(method, *args, &block)
    setting_key    = setting_key_for(method)
    setting_exists = @settings.key?(setting_key)

    if is_settings_query_method?(method)
      setting_exists
    elsif setting_exists
      @settings[setting_key]
    else
      super
{'fraction_non_alphanumeric': 0.09804811620517476, 'fraction_numerical': 0.0, 'mean_word_length': 3.919642857142857, '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': '5605689', 'n_tokens_mistral': 688, 'n_tokens_neox': 681, 'n_words': 156}