Class: CheckerJobs::Configuration
- Inherits:
-
Object
- Object
- CheckerJobs::Configuration
- Defined in:
- lib/checker_jobs/configuration.rb
Constant Summary collapse
- DEFAULT_TIME_BETWEEN_CHECKS =
15 minutes, expressed in seconds
15 * 60
- NOTIFIER_CLASSES =
{ email: "CheckerJobs::Notifiers::Email", logger: "CheckerJobs::Notifiers::Logger", bugsnag: "CheckerJobs::Notifiers::Bugsnag", }.freeze
Instance Attribute Summary collapse
-
#around_check ⇒ Object
Returns the value of attribute around_check.
-
#jobs_processor ⇒ Object
Returns the value of attribute jobs_processor.
-
#notifiers_options ⇒ Object
Returns the value of attribute notifiers_options.
-
#repository_url ⇒ Object
Returns the value of attribute repository_url.
-
#time_between_checks ⇒ Object
Returns the value of attribute time_between_checks.
Class Method Summary collapse
Instance Method Summary collapse
- #jobs_processor_module ⇒ Object
- #notifier(notifier_symbol) {|options| ... } ⇒ Object
- #notifier_class(notifier) ⇒ Object
Instance Attribute Details
#around_check ⇒ Object
Returns the value of attribute around_check.
13 14 15 |
# File 'lib/checker_jobs/configuration.rb', line 13 def around_check @around_check end |
#jobs_processor ⇒ Object
Returns the value of attribute jobs_processor.
13 14 15 |
# File 'lib/checker_jobs/configuration.rb', line 13 def jobs_processor @jobs_processor end |
#notifiers_options ⇒ Object
Returns the value of attribute notifiers_options.
13 14 15 |
# File 'lib/checker_jobs/configuration.rb', line 13 def @notifiers_options end |
#repository_url ⇒ Object
Returns the value of attribute repository_url.
13 14 15 |
# File 'lib/checker_jobs/configuration.rb', line 13 def repository_url @repository_url end |
#time_between_checks ⇒ Object
Returns the value of attribute time_between_checks.
13 14 15 |
# File 'lib/checker_jobs/configuration.rb', line 13 def time_between_checks @time_between_checks end |
Class Method Details
.default ⇒ Object
19 20 21 22 23 24 25 |
# File 'lib/checker_jobs/configuration.rb', line 19 def self.default new.tap do |config| config. = {} config.time_between_checks = DEFAULT_TIME_BETWEEN_CHECKS config.around_check = ->(&block) { block.call } end end |
Instance Method Details
#jobs_processor_module ⇒ Object
33 34 35 36 37 38 39 40 |
# 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| ... } ⇒ Object
27 28 29 30 31 |
# File 'lib/checker_jobs/configuration.rb', line 27 def notifier(notifier_symbol) = (notifier_symbol) yield @notifiers_options[notifier_symbol] = end |
#notifier_class(notifier) ⇒ Object
42 43 44 45 46 47 |
# 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 |