Sha256: a390e562e02af682d829cc581e9da41c430fb3aefe8ba7c8fc20149a2c37ca96

Contents?: true

Size: 572 Bytes

Versions: 6

Compression:

Stored size: 572 Bytes

Contents

# frozen_string_literal: true

module Doorkeeper
  class StaleRecordsCleaner
    CLEANER_CLASS = "StaleRecordsCleaner"

    def self.for(base_scope)
      orm_adapter = "doorkeeper/orm/#{configured_orm}".classify

      orm_cleaner = "#{orm_adapter}::#{CLEANER_CLASS}".constantize
      orm_cleaner.new(base_scope)
    rescue NameError
      raise Doorkeeper::Errors::NoOrmCleaner, "'#{configured_orm}' ORM has no cleaner!"
    end

    def self.configured_orm
      Doorkeeper.config.orm
    end

    def self.new(base_scope)
      self.for(base_scope)
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
doorkeeper-5.3.3 lib/doorkeeper/stale_records_cleaner.rb
doorkeeper-5.4.0.rc2 lib/doorkeeper/stale_records_cleaner.rb
doorkeeper-5.3.2 lib/doorkeeper/stale_records_cleaner.rb
doorkeeper-5.4.0.rc1 lib/doorkeeper/stale_records_cleaner.rb
doorkeeper-5.3.1 lib/doorkeeper/stale_records_cleaner.rb
doorkeeper-5.3.0 lib/doorkeeper/stale_records_cleaner.rb