From 8ad238df762b5bccf1b19343f712c8d1e23656cb Mon Sep 17 00:00:00 2001 From: Peter Goldstein Date: Mon, 25 Apr 2022 13:30:21 -0700 Subject: [PATCH] Make a few updates for latest Rubocop (#908) --- lib/dalli/protocol/base.rb | 4 ++-- lib/dalli/servers_arg_normalizer.rb | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/dalli/protocol/base.rb b/lib/dalli/protocol/base.rb index 1fd9f143..e5a2c39c 100644 --- a/lib/dalli/protocol/base.rb +++ b/lib/dalli/protocol/base.rb @@ -127,11 +127,11 @@ def pipeline_complete? end def username - @options[:username] || ENV['MEMCACHE_USERNAME'] + @options[:username] || ENV.fetch('MEMCACHE_USERNAME', nil) end def password - @options[:password] || ENV['MEMCACHE_PASSWORD'] + @options[:password] || ENV.fetch('MEMCACHE_PASSWORD', nil) end def require_auth? diff --git a/lib/dalli/servers_arg_normalizer.rb b/lib/dalli/servers_arg_normalizer.rb index e355d751..7ce44ca0 100644 --- a/lib/dalli/servers_arg_normalizer.rb +++ b/lib/dalli/servers_arg_normalizer.rb @@ -40,7 +40,7 @@ def self.normalize_servers(arg) def self.apply_defaults(arg) return arg unless arg.nil? - ENV[ENV_VAR_NAME] || DEFAULT_SERVERS + ENV.fetch(ENV_VAR_NAME, nil) || DEFAULT_SERVERS end def self.validate_type(arg)