Sha256: cdb531dccfae11d1b9a8dcb21b002070d86863be37bc9a7fb2b93cfd152d968f

Contents?: true

Size: 1.41 KB

Versions: 3

Compression:

Stored size: 1.41 KB

Contents

# frozen_string_literal: true

require "active_support/lazy_load_hooks"

module Doorkeeper
  module Orm
    module Mongoid4
      def self.run_hooks
        lazy_load do
          require "doorkeeper/orm/mongoid4/access_grant"
          require "doorkeeper/orm/mongoid4/access_token"
          require "doorkeeper/orm/mongoid4/application"
          require "doorkeeper/orm/mongoid4/stale_records_cleaner"
          require "doorkeeper/orm/concerns/mongoid/ownership"
          Doorkeeper::Application.include Doorkeeper::Orm::Concerns::Mongoid::Ownership
        end
        @initialized_hooks = true
      end

      # @deprecated
      def self.initialize_models!
        return if @initialized_hooks

        lazy_load do
          require "doorkeeper/orm/mongoid4/access_grant"
          require "doorkeeper/orm/mongoid4/access_token"
          require "doorkeeper/orm/mongoid4/application"
          require "doorkeeper/orm/mongoid4/stale_records_cleaner"
        end
      end

      # @deprecated
      def self.initialize_application_owner!
        return if @initialized_hooks

        lazy_load do
          require "doorkeeper/orm/concerns/mongoid/ownership"

          Doorkeeper::Application.include Doorkeeper::Orm::Concerns::Mongoid::Ownership
        end
      end

      def self.check_requirements!(_config); end

      def self.lazy_load(&block)
        ActiveSupport.on_load(:mongoid, {}, &block)
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
doorkeeper-mongodb-5.4.0 lib/doorkeeper/orm/mongoid4.rb
doorkeeper-mongodb-5.3.0 lib/doorkeeper/orm/mongoid4.rb
doorkeeper-mongodb-5.2.3 lib/doorkeeper/orm/mongoid4.rb