Class: DruidClient::DruidConfig

Inherits:
Object
  • Object
show all
Defined in:
lib/druid_client/druid_config.rb

Constant Summary collapse

DEFAULTS =
{
  url: 'http://localhost:8888',
  user_agent: 'druid_client.rb',
  timeout: 30,
  verify_ssl: true,
  log_headers: false,
  log_bodies: false
}.freeze

Instance Method Summary collapse

Constructor Details

#initialize(**options) {|_self| ... } ⇒ DruidConfig

Returns a new instance of DruidConfig.

Yields:

  • (_self)

Yield Parameters:



16
17
18
19
20
# File 'lib/druid_client/druid_config.rb', line 16

def initialize(**options)
  @options = DEFAULTS.merge(options)

  yield self if block_given?
end

Instance Method Details

#[](key) ⇒ Object



32
33
34
# File 'lib/druid_client/druid_config.rb', line 32

def [](key)
  @options[key]
end

#keysObject



28
29
30
# File 'lib/druid_client/druid_config.rb', line 28

def keys
  @options.keys
end

#verify!Object

Raises:



22
23
24
25
26
# File 'lib/druid_client/druid_config.rb', line 22

def verify!
  return if @options[:url].to_s.size.positive?

  raise ConfigError, 'Missing url in DruidConfig'
end