<commit_before>module AASM
  module Persistence
    class << self

      def load_persistence(base)
        # Use a fancier auto-loading thingy, perhaps.  When there are more persistence engines.
        hierarchy = base.ancestors.map {|klass| klass.to_s}

        if hierarchy.include?("ActiveRecord::Base")
          require_files_for('active_record_persistence')
          base.send(:include, AASM::Persistence::ActiveRecordPersistence)
        elsif hierarchy.include?("Mongoid::Document")
          require_files_for('mongoid_persistence')
          base.send(:include, AASM::Persistence::MongoidPersistence)
        end
      end

    private

      def require_files_for(persistence)
        require File.join(File.dirname(__FILE__), 'persistence', 'base')
        require File.join(File.dirname(__FILE__), 'persistence', 'read_state')
        require File.join(File.dirname(__FILE__), 'persistence', persistence)
      end
<commit_msg>shorten the persistence loading stuff a bit<commit_after>module AASM
  module Persistence
    class << self

      def load_persistence(base)
        # Use a fancier auto-loading thingy, perhaps.  When there are more persistence engines.
        hierarchy = base.ancestors.map {|klass| klass.to_s}

        if hierarchy.include?("ActiveRecord::Base")
          require_files_for(:active_record)
          base.send(:include, AASM::Persistence::ActiveRecordPersistence)
        elsif hierarchy.include?("Mongoid::Document")
          require_files_for(:mongoid)
          base.send(:include, AASM::Persistence::MongoidPersistence)
        end
      end

    private

      def require_files_for(persistence)
        ['base', 'read_state', "#{persistence}_persistence"].each do |file_name|
          require File.join(File.dirname(__FILE__), 'persistence', file_name)
        end
      end

{'fraction_non_alphanumeric': 0.10158383397050792, 'fraction_numerical': 0.0, 'mean_word_length': 3.240740740740741, 'pattern_counts': {'":': 0, '<': 7, '<?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': '5594875', 'n_tokens_mistral': 516, 'n_tokens_neox': 515, 'n_words': 108}