<commit_before>require 'rspec'

RSpec.configure do |config|
end

require 'web_ui_components'<commit_msg>add dynamic class creation for easily creating non-colliding subclasses for testing classes that are meant to be subclassed in the API<commit_after>require 'rspec'

RSpec.configure do |config|
end

require 'web_ui_components'

# Creates a subclass of the given class with no name, i.e.
# not assigned to a constant
def dynamic_anonymous_subclass class_to_subclass
  Class.new(class_to_subclass)
end

# Creates a class, which is a subclass of the given class
def dynamic_subclass class_to_subclass = Object, opts = {}
  opts = { :class_location => self.class, :class_prefix => "", :class_suffix => "", :class_identifier => "DynamicClass", :class_unique_id => self.object_id }.merge(opts)
  class_name = opts[:class_name] ? opts[:class_name] : "#{opts[:class_prefix]}#{opts[:class_identifier]}#{opts[:class_unique_id]}#{opts[:class_suffix]}"
  opts[:class_location].const_set(class_name, dynamic_anonymous_subclass(class_to_subclass))
end
{'fraction_non_alphanumeric': 0.10865384615384616, 'fraction_numerical': 0.0, 'mean_word_length': 6.9465648854961835, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 8, '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': '4850635', 'n_tokens_mistral': 327, 'n_tokens_neox': 324, 'n_words': 89}