class CheckerJobs::Configuration
Constants
- DEFAULT_TIME_BETWEEN_CHECKS
- NOTIFIER_CLASSES
Attributes
around_check[RW]
jobs_processor[RW]
notifiers_options[RW]
repository_url[RW]
time_between_checks[RW]
Public Class Methods
default()
click to toggle source
# File lib/checker_jobs/configuration.rb, line 19 def self.default new.tap do |config| config.notifiers_options = {} config.time_between_checks = DEFAULT_TIME_BETWEEN_CHECKS config.around_check = ->(&block) { block.call } end end
Public Instance Methods
jobs_processor_module()
click to toggle source
# File lib/checker_jobs/configuration.rb, line 33 def jobs_processor_module case jobs_processor when :sidekiq CheckerJobs::JobsProcessors::Sidekiq else raise CheckerJobs::UnsupportedConfigurationOption.new(:jobs_processor, jobs_processor) end end
notifier(notifier_symbol) { |options| ... }
click to toggle source
# File lib/checker_jobs/configuration.rb, line 27 def notifier(notifier_symbol) options = default_options_for(notifier_symbol) yield options @notifiers_options[notifier_symbol] = options end
notifier_class(notifier)
click to toggle source
# File lib/checker_jobs/configuration.rb, line 42 def notifier_class(notifier) notifier_class_name = NOTIFIER_CLASSES.fetch(notifier) do raise CheckerJobs::UnsupportedConfigurationOption.new(:notifier, notifier) end Object.const_get(notifier_class_name) end
Private Instance Methods
default_options_for(notifier_symbol)
click to toggle source
# File lib/checker_jobs/configuration.rb, line 51 def default_options_for(notifier_symbol) klass = notifier_class(notifier_symbol) klass.respond_to?(:default_options) ? klass.default_options : {} end