Sha256: b4cd3c33cfb64628a530fcf6258c7c0c28b012e7e2826e8b4328df2c79ff1f90

Contents?: true

Size: 477 Bytes

Versions: 4

Compression:

Stored size: 477 Bytes

Contents

module PluckAll
  class Hooks
    class << self
      def init
        require 'pluck_all/models/active_record_extension' if require_if_exists('active_record')
        require 'pluck_all/models/mongoid_extension' if require_if_exists('mongoid')
      end

      private

      def require_if_exists(path)
        require path
        return true
      rescue LoadError, Gem::LoadError
        return false
      end
    end
  end
end

PluckAll::Hooks.init

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
pluck_all-2.3.4 lib/pluck_all/hooks.rb
pluck_all-2.3.3 lib/pluck_all/hooks.rb
pluck_all-2.3.2 lib/pluck_all/hooks.rb
pluck_all-2.3.1 lib/pluck_all/hooks.rb