<commit_before>require 'yaml'

module Mach5Tools
  class Project
    def initialize(filename)
      @yaml = YAML.load_file(filename)
    end

    def before
      @yaml["before"].each do |cmd|
        Kernel.system cmd
      end
    end

    def run
      @yaml["run"].each do |cmd|
        Kernel.system cmd
      end
    end

    def after
      @yaml["after"].each do |cmd|
        Kernel.system cmd
      end
    end
  end
end<commit_msg>Refactoring after, before and run methods of Project class<commit_after>require 'yaml'

module Mach5Tools
  class Project
    def initialize(filename)
      @yaml = YAML.load_file(filename)
    end

    %w{before run after}.each do |method|
      define_method(method) do
        @yaml[method].each do |cmd|
          Kernel.system cmd
        end
      end
    end

  end
end
{'fraction_non_alphanumeric': 0.08190709046454768, 'fraction_numerical': 0.0024449877750611247, 'mean_word_length': 2.1379310344827585, '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': '6929082', 'n_tokens_mistral': 259, 'n_tokens_neox': 247, 'n_words': 75}