class RedisClient::Config

Constants

DEFAULT_DB
DEFAULT_HOST
DEFAULT_PORT
DEFAULT_TIMEOUT
DEFAULT_USERNAME

Attributes

host[R]
path[R]
port[R]

Public Class Methods

new( url: nil, host: nil, port: nil, path: nil, **kwargs ) click to toggle source
Calls superclass method RedisClient::Config::Common::new
# File lib/redis_client/config.rb, line 157
def initialize(
  url: nil,
  host: nil,
  port: nil,
  path: nil,
  **kwargs
)
  if url
    url_config = URLConfig.new(url)
    kwargs = {
      ssl: url_config.ssl?,
      username: url_config.username,
      password: url_config.password,
      db: url_config.db,
    }.compact.merge(kwargs)
    host ||= url_config.host
    port ||= url_config.port
  end

  super(**kwargs)

  @host = host || DEFAULT_HOST
  @port = Integer(port || DEFAULT_PORT)
  @path = path
end