lib/stockpile/base.rb in stockpile-1.1 vs lib/stockpile/base.rb in stockpile-2.0

- old
+ new

@@ -1,6 +1,6 @@ -# coding: utf-8 +# frozen_string_literal: true require 'stockpile' class Stockpile # The base connection manager, providing some common functionality for @@ -26,10 +26,11 @@ # +narrow+:: Use a narrow connection width if true; if not provided, # uses the value of ::Stockpile.narrow? in this connection # manager. def initialize(options = {}) @options = options.dup + @options = options.to_h unless @options.kind_of?(Hash) @narrow = !!@options.fetch(:narrow, ::Stockpile.narrow?) @connection = nil @clients = {} @options.delete(:narrow) @@ -119,10 +120,11 @@ client_disconnect end private + # Converts +client_names+ into a hash of client names to options. # # * A Hash object, mapping client names to client options. # # connect(redis: nil, rollout: { namespace: 'rollout' }) @@ -167,20 +169,20 @@ end }.inject({}, :merge) end # Performs a client connect action. Must be implemented by a client. - def client_connect(name = nil, options = {}) - raise NotImplementedError + def client_connect(_name = nil, _options = {}) + fail NotImplementedError end # Performs a client reconnect action. Must be implemented by a client. - def client_reconnect(client = connect()) - raise NotImplementedError + def client_reconnect(_client = connect) + fail NotImplementedError end # Performs a client disconnect action. Must be implemented by a client. - def client_disconnect(client = connect()) - raise NotImplementedError + def client_disconnect(_client = connect) + fail NotImplementedError end end end