<commit_before>require 'palletjack'
require 'fileutils'
require 'optparse'
require 'singleton'
require 'rugged'

class PalletJack

  # Superclass for PalletJack tool implementations
  #
  # Provides convenience methods for option parsing, file generation,
  # and warehouse structure management.
  #
  # Example:
  #   require 'palletjack/tool'
  #
  #   class MyTool < PalletJack::Tool
  #     def parse_options(parser)
  #       parser.on('-o DIR', '--output DIR',
  #                 'output directory',
  #                 String) {|dir| options[:output] = dir }
  #
  #       required_option :output
  #     end
  #   end
  #
  #   MyTool.run do
  #     jack['system'].each do |sys|
  #        config_dir :output, sys.name
  #        config_file :output, sys.name, "dump.yaml" do |file|
  #          file << sys.to_yaml
  #        end
  #     end
  #   end

  class Tool
    include Singleton

    # Run the +block+ given in the context of the tool singleton instance
    # as convenience for simple tools.
    #
    # More complex tools probably want to override initialize to
    # add option parsing, and split functionality into multiple methods.
    #
    # Example:
    #
    # MyTool.run { jack['system'].each {|sys| puts sys.to_yaml } }

    def self.run(&block)
      instance.instance_eval(&block)
    end

    # Initialize the singleton instance
    #
    # Default initialization will add options for --warehouse and --help
    # to the OptionParser, and set the banner to something useful.
    #<commit_msg>Correct rdoc for self.run<commit_after>require 'palletjack'
require 'fileutils'
require 'optparse'
require 'singleton'
require 'rugged'

class PalletJack

  # Superclass for PalletJack tool implementations
  #
  # Provides convenience methods for option parsing, file generation,
  # and warehouse structure management.
  #
  # Example:
  #   require 'palletjack/tool'
  #
  #   class MyTool < PalletJack::Tool
  #     def parse_options(parser)
  #       parser.on('-o DIR', '--output DIR',
  #                 'output directory',
  #                 String) {|dir| options[:output] = dir }
  #
  #       required_option :output
  #     end
  #   end
  #
  #   MyTool.run do
  #     jack['system'].each do |sys|
  #        config_dir :output, sys.name
  #        config_file :output, sys.name, "dump.yaml" do |file|
  #          file << sys.to_yaml
  #        end
  #     end
  #   end

  class Tool
    include Singleton

    # Run the +block+ given in the context of the tool singleton instance
    # as convenience for simple tools.
    #
    # More complex tools probably want to override parse_options to
    # add option parsing, and split functionality into multiple methods.
    #
    # Example:
    #
    #   MyTool.run { jack['system'].each {|sys| puts sys.to_yaml } }

    def self.run(&block)
      instance.instance_eval(&block)
    end

    # Initialize the singleton instance
    #
    # Default initialization will add options for --warehouse and --help
    # to the OptionParser, and set the banner to something useful.
    #
{'fraction_non_alphanumeric': 0.09488099119660906, 'fraction_numerical': 0.0, 'mean_word_length': 2.4126807563959956, 'pattern_counts': {'":': 0, '<': 9, '<?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': '6681399', 'n_tokens_mistral': 925, 'n_tokens_neox': 899, 'n_words': 287}