module Bullet::Dependency

Public Instance Methods

active_record40?() click to toggle source
# File lib/bullet/dependency.rb, line 59
def active_record40?
  active_record4? && ::ActiveRecord::VERSION::MINOR == 0
end
active_record41?() click to toggle source
# File lib/bullet/dependency.rb, line 63
def active_record41?
  active_record4? && ::ActiveRecord::VERSION::MINOR == 1
end
active_record42?() click to toggle source
# File lib/bullet/dependency.rb, line 67
def active_record42?
  active_record4? && ::ActiveRecord::VERSION::MINOR == 2
end
active_record4?() click to toggle source
# File lib/bullet/dependency.rb, line 51
def active_record4?
  active_record? && ::ActiveRecord::VERSION::MAJOR == 4
end
active_record50?() click to toggle source
# File lib/bullet/dependency.rb, line 71
def active_record50?
  active_record5? && ::ActiveRecord::VERSION::MINOR == 0
end
active_record51?() click to toggle source
# File lib/bullet/dependency.rb, line 75
def active_record51?
  active_record5? && ::ActiveRecord::VERSION::MINOR == 1
end
active_record52?() click to toggle source
# File lib/bullet/dependency.rb, line 79
def active_record52?
  active_record5? && ::ActiveRecord::VERSION::MINOR == 2
end
active_record5?() click to toggle source
# File lib/bullet/dependency.rb, line 55
def active_record5?
  active_record? && ::ActiveRecord::VERSION::MAJOR == 5
end
active_record?() click to toggle source
# File lib/bullet/dependency.rb, line 9
def active_record?
  @active_record ||= defined? ::ActiveRecord
end
active_record_version() click to toggle source
# File lib/bullet/dependency.rb, line 17
def active_record_version
  @active_record_version ||= begin
                               if active_record40?
                                 'active_record4'
                               elsif active_record41?
                                 'active_record41'
                               elsif active_record42?
                                 'active_record42'
                               elsif active_record50?
                                 'active_record5'
                               elsif active_record51?
                                 'active_record5'
                               elsif active_record52?
                                 'active_record52'
                               else
                                 raise "Bullet does not support active_record #{::ActiveRecord::VERSION} yet"
                               end
                             end
end
mongoid4x?() click to toggle source
# File lib/bullet/dependency.rb, line 83
def mongoid4x?
  mongoid? && ::Mongoid::VERSION =~ /\A4/
end
mongoid5x?() click to toggle source
# File lib/bullet/dependency.rb, line 87
def mongoid5x?
  mongoid? && ::Mongoid::VERSION =~ /\A5/
end
mongoid6x?() click to toggle source
# File lib/bullet/dependency.rb, line 91
def mongoid6x?
  mongoid? && ::Mongoid::VERSION =~ /\A6/
end
mongoid?() click to toggle source
# File lib/bullet/dependency.rb, line 5
def mongoid?
  @mongoid ||= defined? ::Mongoid
end
mongoid_version() click to toggle source
# File lib/bullet/dependency.rb, line 37
def mongoid_version
  @mongoid_version ||= begin
                         if mongoid4x?
                           'mongoid4x'
                         elsif mongoid5x?
                           'mongoid5x'
                         elsif mongoid6x?
                           'mongoid6x'
                         else
                           raise "Bullet does not support mongoid #{::Mongoid::VERSION} yet"
                         end
                       end
end
rails?() click to toggle source
# File lib/bullet/dependency.rb, line 13
def rails?
  @rails ||= defined? ::Rails
end