Class: Doorkeeper::StaleRecordsCleaner

Inherits:
Object
  • Object
show all
Defined in:
lib/doorkeeper/stale_records_cleaner.rb

Constant Summary collapse

CLEANER_CLASS =
"StaleRecordsCleaner"

Class Method Summary collapse

Class Method Details

.configured_ormObject



20
21
22
# File 'lib/doorkeeper/stale_records_cleaner.rb', line 20

def self.configured_orm
  Doorkeeper.config.orm
end

.for(base_scope) ⇒ Object



7
8
9
10
11
12
13
14
# File 'lib/doorkeeper/stale_records_cleaner.rb', line 7

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

.new(base_scope) ⇒ Object



16
17
18
# File 'lib/doorkeeper/stale_records_cleaner.rb', line 16

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