<commit_before>use v6;

use MongoDB;
use Config::DataLang::Refine;

#-------------------------------------------------------------------------------
unit package MongoDB:auth<github:MARTIMM>;

#-------------------------------------------------------------------------------
# Singleton class used to maintain config for whole of mongodb
#
class MDBConfig {

  my MongoDB::MDBConfig $instance;
  has Config::DataLang::Refine $.cfg handles 'config';

  #-----------------------------------------------------------------------------
  submethod BUILD (
    Str :$config-name,
    Bool :$merge,
    Array :$locations,
    Str :$data-module
  ) {
    $!cfg = Config::DataLang::Refine.new(
      :$config-name,
      :$merge,
      :$locations,
      :$data-module
    );
  }

  #-----------------------------------------------------------------------------
  # Forbidden method
  #
  method new ( ) { !!! }

  #-----------------------------------------------------------------------------
  # File can be set once a lifitime of the object
  #
  method instance (
    Str :$config-name,
    Bool :$merge,
    Array :$locations,
    Str :$data-module = 'Config::TOML'

    --> MongoDB::MDBConfig
  ) {

    if not $instance.defined {
      $instance = MongoDB::MDBConfig.bless(
        :$config-name,
        :$merge,
        :$locations,
        :$data-module
      );
    }

    $instance;
  }
}
<commit_msg>simplification to assume always TOML config format<commit_after>use v6;

use MongoDB;
use Config::DataLang::Refine;

#------------------------------------------------------------------------------
unit package MongoDB:auth<github:MARTIMM>;

#------------------------------------------------------------------------------
# Singleton class used to maintain config for whole of mongodb
class MDBConfig {

  my MongoDB::MDBConfig $instance;
  has Config::DataLang::Refine $.cfg handles 'config';

  #----------------------------------------------------------------------------
  submethod BUILD ( Str :$config-name, Bool :$merge, Array :$locations ) {
    $!cfg = Config::DataLang::Refine.new(
      :$config-name, :$merge, :$locations,
    );
  }

  #----------------------------------------------------------------------------
  # Forbidden method
  method new ( ) { !!! }

  #----------------------------------------------------------------------------
  # File can be set once a lifetime of the object
  method instance (
    Str :$config-name = 'config.toml',
    Bool :$merge = False,
    Array :$locations = []

    --> MongoDB::MDBConfig
  ) {
    $instance = MongoDB::MDBConfig.bless( :$config-name, :$merge, :$locations)
      unless $instance.defined;

    $instance;
  }
}

{'fraction_non_alphanumeric': 0.3880819366852886, 'fraction_numerical': 0.0007448789571694599, 'mean_word_length': 1.113296616837136, 'pattern_counts': {'":': 0, '<': 5, '<?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': '4300538', 'n_tokens_mistral': 712, 'n_tokens_neox': 668, 'n_words': 162}