lib/percy/redis_client.rb in percy-common-3.1.0 vs lib/percy/redis_client.rb in percy-common-3.1.1
- old
+ new
@@ -6,24 +6,26 @@
class RedisClient
attr_reader :options
attr_reader :client
def initialize(options = {})
- @options = options
- @client = ::Redis.new(
- options.merge(
- ssl: ssl_enabled?,
- ssl_params: ssl_params,
- ),
- )
+ @options = ssl_options.merge(options)
+ @client = ::Redis.new(options)
end
private def ssl_enabled?
provided_url.to_s.start_with?('rediss://')
end
private def provided_url
- options.dig(:url)
+ options&.dig(:url)
+ end
+
+ private def ssl_options
+ {
+ ssl: ssl_enabled?,
+ ssl_params: ssl_params,
+ }
end
private def ssl_params
return {} unless ssl_enabled?