Sha256: 77f9e9a846d6ba6537f30a2c77448476324756bc79c1f58b3a62a0897dbbdbaf

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 Mongoid5
      def self.run_hooks
        lazy_load do
          require "doorkeeper/orm/mongoid5/access_grant"
          require "doorkeeper/orm/mongoid5/access_token"
          require "doorkeeper/orm/mongoid5/application"
          require "doorkeeper/orm/mongoid5/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/mongoid5/access_grant"
          require "doorkeeper/orm/mongoid5/access_token"
          require "doorkeeper/orm/mongoid5/application"
          require "doorkeeper/orm/mongoid5/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/mongoid5.rb
doorkeeper-mongodb-5.3.0 lib/doorkeeper/orm/mongoid5.rb
doorkeeper-mongodb-5.2.3 lib/doorkeeper/orm/mongoid5.rb