<commit_before>$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
$LOAD_PATH.unshift(File.dirname(__FILE__))
require 'rspec'
require 'background_queue'

# Requires supporting files with custom matchers and macros, etc,
# in ./support/ and its subdirectories.
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}

RSpec.configure do |config|
  
end<commit_msg>add helper to access private methods from tests<commit_after>$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
$LOAD_PATH.unshift(File.dirname(__FILE__))
require 'rspec'
require 'background_queue'

# Requires supporting files with custom matchers and macros, etc,
# in ./support/ and its subdirectories.
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}

RSpec.configure do |config|
  
end

#i want to be able to test private methods
#this will let me prefix the call with __prv__ and it will then use send to route to the private call
#this assumes the class getting tested does not use method_missing
class Object
  
  alias_method :_original_method_missing, :method_missing
  
  def method_missing(sym, *args, &block)
    if sym.to_s[0, 7] == "__prv__"
      #we are explicily saying this should be a private method.. lets make sure...
      
      private_method = sym.to_s[7, sym.to_s.length - 7].intern
      
      raise "Method #{private_method} is public when it was expected to be private" if respond_to?(private_method)
      
      send private_method, *args, &block
    else
      _original_method_missing(sym, *args, &block)
    end
  end
  
  
end
{'fraction_non_alphanumeric': 0.11502199874292897, 'fraction_numerical': 0.00251414204902577, 'mean_word_length': 4.185667752442996, 'pattern_counts': {'":': 0, '<': 3, '<?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': '1734868', 'n_tokens_mistral': 506, 'n_tokens_neox': 503, 'n_words': 159}