1
0
Fork 0
mirror of https://github.com/mperham/sidekiq.git synced 2022-11-09 13:52:34 -05:00

Style improvements and key checking simplification

This commit is contained in:
Artur Cygan 2014-12-17 21:08:43 +01:00
parent b1bc022125
commit b70c3ef50d

View file

@ -10,21 +10,21 @@ require 'sidekiq/redis_connection'
require 'json'
module Sidekiq
NAME = "Sidekiq"
NAME = 'Sidekiq'
LICENSE = 'See LICENSE and the LGPL-3.0 for licensing details.'
DEFAULTS = {
:queues => [],
:labels => [],
:concurrency => 25,
:require => '.',
:environment => nil,
:timeout => 8,
:error_handlers => [],
:lifecycle_events => {
:startup => [],
:quiet => [],
:shutdown => [],
queues: [],
labels: [],
concurrency: 25,
require: '.',
environment: nil,
timeout: 8,
error_handlers: [],
lifecycle_events: {
startup: [],
quiet: [],
shutdown: [],
}
}
@ -146,7 +146,7 @@ module Sidekiq
# end
def self.on(event, &block)
raise ArgumentError, "Symbols only please: #{event}" unless event.is_a?(Symbol)
raise ArgumentError, "Invalid event name: #{event}" unless options[:lifecycle_events].keys.include?(event)
raise ArgumentError, "Invalid event name: #{event}" unless options[:lifecycle_events].key?(event)
options[:lifecycle_events][event] << block
end
end