<commit_before>require 'peribot/configuration'
require 'peribot/middleware'
require 'peribot/preprocessor'
require 'peribot/postprocessor'
require 'peribot/sender'
require 'peribot/services'
require 'peribot/version'

require 'concurrent'
require 'docile'
require 'pstore'
require 'yaml'

# The top-level namespace for Peribot. Some global functionality is also
# provided as part of this module.
module Peribot
  class << self
    attr_reader :meta_config
  end

  module_function

  # A simple logging function for use by Peribot components. Outputs the given
  # message to stderr with a "[Peribot]" prefix.
  #
  # @param message Text to output to stderr
  def log(message)
    $stderr.puts "[Peribot] #{message}"
  end

  # Execute a DSL to configure a Peribot instance. This is used to set
  # directories for configuration and persistent store files.
  def configure(&block)
    builder = Peribot::Configuration::Builder.new
    @meta_config = Docile.dsl_eval(builder, &block).build

    reset_config_builder
    reset_store_map
  end

  # Retrieve a read-only object containing information read from the
  # configuration directory set via the configure method.
  def config
    @config_builder.value || (fail @config_builder.reason)<commit_msg>Ensure that internal store map isn't leaked<commit_after>require 'peribot/configuration'
require 'peribot/middleware'
require 'peribot/preprocessor'
require 'peribot/postprocessor'
require 'peribot/sender'
require 'peribot/services'
require 'peribot/version'

require 'concurrent'
require 'docile'
require 'pstore'
require 'yaml'

# The top-level namespace for Peribot. Some global functionality is also
# provided as part of this module.
module Peribot
  class << self
    attr_reader :meta_config
  end

  module_function

  # A simple logging function for use by Peribot components. Outputs the given
  # message to stderr with a "[Peribot]" prefix.
  #
  # @param message Text to output to stderr
  def log(message)
    $stderr.puts "[Peribot] #{message}"
  end

  # Execute a DSL to configure a Peribot instance. This is used to set
  # directories for configuration and persistent store files.
  def configure(&block)
    builder = Peribot::Configuration::Builder.new
    @meta_config = Docile.dsl_eval(builder, &block).build

    reset_config_builder
    reset_store_map

    nil
  end

  # Retrieve a read-only object containing information read from the
  # configuration directory set via the configure method.
  def config
    @config_builder.value || (fail @config_builder.reason)
{'fraction_non_alphanumeric': 0.075049115913556, 'fraction_numerical': 0.0, 'mean_word_length': 4.36, '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': '2918076', 'n_tokens_mistral': 755, 'n_tokens_neox': 735, 'n_words': 264}