Module: SolidQueueGuard::OptionalDependency Private

Defined in:
lib/solid_queue_guard/optional_dependency.rb

This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.

Class Method Summary collapse

Class Method Details

.log_missing(gem_name) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



16
17
18
19
20
21
22
23
# File 'lib/solid_queue_guard/optional_dependency.rb', line 16

def log_missing(gem_name)
  return unless defined?(Rails) && Rails.logger

  Rails.logger.warn(
    "[solid_queue_guard] Optional dependency #{gem_name} is not installed. " \
    'Add it to your Gemfile to enable this integration.'
  )
end

.require!(feature, gem_name = feature) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



8
9
10
11
12
13
14
# File 'lib/solid_queue_guard/optional_dependency.rb', line 8

def require!(feature, gem_name = feature)
  require feature
  true
rescue LoadError
  log_missing(gem_name)
  false
end