From 528ca61ab270198fe56f65bbf35265790e3ae748 Mon Sep 17 00:00:00 2001 From: Mike Perham Date: Mon, 15 May 2017 14:50:23 -0700 Subject: [PATCH] inline stringify --- lib/sidekiq.rb | 6 +----- lib/sidekiq/worker.rb | 7 +------ 2 files changed, 2 insertions(+), 11 deletions(-) diff --git a/lib/sidekiq.rb b/lib/sidekiq.rb index a4d17a7f..3eec7408 100644 --- a/lib/sidekiq.rb +++ b/lib/sidekiq.rb @@ -149,12 +149,8 @@ module Sidekiq end def self.default_worker_options=(hash) - h = hash.dup # stringify - h.keys.each do |key| - h[key.to_s] = h.delete(key) - end - @default_worker_options = default_worker_options.merge(h) + @default_worker_options = default_worker_options.merge(Hash[hash.map{|k, v| [k.to_s, v]}]) end def self.default_worker_options defined?(@default_worker_options) ? @default_worker_options : DEFAULT_WORKER_OPTIONS diff --git a/lib/sidekiq/worker.rb b/lib/sidekiq/worker.rb index c85ddcb6..b535ecc7 100644 --- a/lib/sidekiq/worker.rb +++ b/lib/sidekiq/worker.rb @@ -117,13 +117,8 @@ module Sidekiq # In practice, any option is allowed. This is the main mechanism to configure the # options for a specific job. def sidekiq_options(opts={}) - h = opts.dup # stringify - h.keys.each do |key| - h[key.to_s] = h.delete(key) - end - - self.sidekiq_options_hash = get_sidekiq_options.merge(h) + self.sidekiq_options_hash = get_sidekiq_options.merge(Hash[opts.map{|k, v| [k.to_s, v]}]) end def sidekiq_retry_in(&block)