<commit_before>module Bullet
  module Dependency
    def mongoid?
      @mongoid ||= defined? ::Mongoid
    end

    def active_record?
      @active_record ||= defined? ::ActiveRecord
    end

    def rails?
      @rails ||= defined? ::Rails
    end

    def active_record_version
      @active_record_version ||= begin
                                   if active_record30?
                                     'active_record3'
                                   elsif active_record31? || active_record32?
                                     'active_record3x'
                                   elsif active_record40?
                                     'active_record4'
                                   elsif active_record41?
                                     'active_record41'
                                   elsif active_record42?
                                     'active_record42'
                                   elsif active_record50?
                                     'active_record5'
                                   elsif active_record51?
                                     'active_record5'
                                   end
                                 end
    end

    def mongoid_version
      @mongoid_version ||= begin
                             if mongoid2x?
                               'mongoid2x'
                             elsif mongoid3x?
                               'mongoid3x'
                             elsif mongoid4x?
                               'mongoid4x'
                             elsif mongoid5x?
                               'mongoid5x'
                             end
                           end
    end

    def active_record3?
      active_record? && ::ActiveRecord::VERSION::MAJOR == 3
    end

    def active_record4?<commit_msg>raise an error if bullet does not support AR or Mongoid<commit_after>module Bullet
  module Dependency
    def mongoid?
      @mongoid ||= defined? ::Mongoid
    end

    def active_record?
      @active_record ||= defined? ::ActiveRecord
    end

    def rails?
      @rails ||= defined? ::Rails
    end

    def active_record_version
      @active_record_version ||= begin
                                   if active_record30?
                                     'active_record3'
                                   elsif active_record31? || active_record32?
                                     'active_record3x'
                                   elsif active_record40?
                                     'active_record4'
                                   elsif active_record41?
                                     'active_record41'
                                   elsif active_record42?
                                     'active_record42'
                                   elsif active_record50?
                                     'active_record5'
                                   elsif active_record51?
                                     'active_record5'
                                   else
                                     raise "Bullet does not support active_record #{::ActiveRecord::VERSION} yet"
                                   end
                                 end
    end

    def mongoid_version
      @mongoid_version ||= begin
                             if mongoid2x?
                               'mongoid2x'
                             elsif mongoid3x?
                               'mongoid3x'
                             elsif mongoid4x?
                               'mongoid4x'
                             elsif mongoid5x?
                               'mongoid5x'
                             else
                               raise "Bullet does not support mongoid #{::Mongoid::VERSION} yet"
                             end
                           end
    end

    def active_record3?
      active_record? && ::ActiveRecord::VERSION::MAJOR == 3
    end

    def active_record4?
{'fraction_non_alphanumeric': 0.04686318972033258, 'fraction_numerical': 0.018140589569160998, 'mean_word_length': 0.7574147853032315, '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': 34, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1325551', 'n_tokens_mistral': 914, 'n_tokens_neox': 839, 'n_words': 183}