<commit_before>module Phony

  # For country definitions.
  #
  # There are two styles: With or without block.
  # Use the block if you have multiple.
  #
  # Examples:
  # Phony.define do
  #   country ...
  # end
  #
  # Phony.define.country ...
  #
  def self.define
    dsl = DSL.new
    dsl.instance_eval(&Proc.new) if block_given?
    dsl
  end

  # Contains a number of DSL methods. Is used e.g. in the countries.rb file.
  #
  # Do not use directly, but instead use {Phony.define} to execute a block
  # in the DSL instance's context.
  #
  # @example
  #   Phony.define { ... }
  #
  class DSL

    # Define a country's rules.
    #
    # Use the other DSL methods to define the country's rules.
    #
    # @param [String] country_code The country code of the country.
    # @param [Phony::CountryCodes] definition Rules for this country.
    #
    # @return Undefined.
    #
    # @example Add a country with country code 27.
    #   country '27', # CC, followed by rules, for example fixed(2) >> ...
    #
    def country country_code, definition, options = {}
      definition.with country_code, options
      Phony::CountryCodes.instance.add country_code, definition
    end
    
    # Designates a country code as reserved.
    # A reserved country will result in an exception when trying to be used.
    #
    # @param [String] country_code The country code of the country.
    #
    # @return nil
    #
    # @example Designate country code 27 as reserved.
    #   reserved('27')
    #
    def reserved country_code
      # Does nothing, will just fail with an exception.
    end
    
    # Define a country to use default rules (and to be done at some point).
    #
    # @return Rules for a country.<commit_msg>Only load country if defined in Config.<commit_after>module Phony

  # For country definitions.
  #
  # There are two styles: With or without block.
  # Use the block if you have multiple.
  #
  # Examples:
  # Phony.define do
  #   country ...
  # end
  #
  # Phony.define.country ...
  #
  def self.define
    dsl = DSL.new
    dsl.instance_eval(&Proc.new) if block_given?
    dsl
  end

  # Contains a number of DSL methods. Is used e.g. in the countries.rb file.
  #
  # Do not use directly, but instead use {Phony.define} to execute a block
  # in the DSL instance's context.
  #
  # @example
  #   Phony.define { ... }
  #
  class DSL

    # Define a country's rules.
    #
    # Use the other DSL methods to define the country's rules.
    #
    # @param [String] country_code The country code of the country.
    # @param [Phony::CountryCodes] definition Rules for this country.
    #
    # @return Undefined.
    #
    # @example Add a country with country code 27.
    #   country '27', # CC, followed by rules, for example fixed(2) >> ...
    #
    def country country_code, definition, options = {}
      return unless Phony.config.load?(country_code)
      
      definition.with country_code, options
      Phony::CountryCodes.instance.add country_code, definition
    end
    
    # Designates a country code as reserved.
    # A reserved country will result in an exception when trying to be used.
    #
    # @param [String] country_code The country code of the country.
    #
    # @return nil
    #
    # @example Designate country code 27 as reserved.
    #   reserved('27')
    #
    def reserved country_code
      # Does nothing, will just fail with an exception.
    end
    
    # Define a country to use default rules (and to be done at some point).
    #
    # @return Rules for a country.
{'fraction_non_alphanumeric': 0.08798646362098139, 'fraction_numerical': 0.005076142131979695, 'mean_word_length': 2.3652751423149905, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '6152726', 'n_tokens_mistral': 1089, 'n_tokens_neox': 1057, 'n_words': 406}