Sha256: 78ae6d2da6fb9937e371ce2a83c72d42a369e24815d55620fe8191dfcb9b9828
Contents?: true
Size: 1.8 KB
Versions: 2
Compression:
Stored size: 1.8 KB
Contents
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_record4? 'active_record4' end end end def mongoid_version @mongoid_version ||= begin if mongoid2x? 'mongoid2x' elsif mongoid3x? 'mongoid3x' elsif mongoid4x? 'mongoid4x' end end end def active_record3? active_record? && ::ActiveRecord::VERSION::MAJOR == 3 end def active_record4? active_record? && ::ActiveRecord::VERSION::MAJOR == 4 end def active_record30? active_record3? && ::ActiveRecord::VERSION::MINOR == 0 end def active_record31? active_record3? && ::ActiveRecord::VERSION::MINOR == 1 end def active_record32? active_record3? && ::ActiveRecord::VERSION::MINOR == 2 end def mongoid2x? mongoid? && ::Mongoid::VERSION =~ /\A2\.[4-8]/ end def mongoid3x? mongoid? && ::Mongoid::VERSION =~ /\A3/ end def mongoid4x? mongoid? && ::Mongoid::VERSION =~ /\A4/ end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
bullet-4.7.1 | lib/bullet/dependency.rb |
bullet-4.7.0 | lib/bullet/dependency.rb |