Class: Lepus::Producers::Config

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/lepus/producers/config.rb

Overview

Configuration class for producer settings

Constant Summary collapse

DEFAULT_POOL_SIZE =
1
DEFAULT_POOL_TIMEOUT =
5.0

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfig

Returns a new instance of Config.



18
19
20
21
# File 'lib/lepus/producers/config.rb', line 18

def initialize
  @pool_size = DEFAULT_POOL_SIZE
  @pool_timeout = DEFAULT_POOL_TIMEOUT
end

Instance Attribute Details

#pool_sizeObject

Returns the value of attribute pool_size.



14
15
16
# File 'lib/lepus/producers/config.rb', line 14

def pool_size
  @pool_size
end

#pool_timeoutObject

Returns the value of attribute pool_timeout.



14
15
16
# File 'lib/lepus/producers/config.rb', line 14

def pool_timeout
  @pool_timeout
end

Instance Method Details

#assign(options = {}) ⇒ void

This method returns an undefined value.

Assign multiple attributes at once from a hash of options.

Parameters:

  • options (Hash) (defaults to: {})

    hash of options to assign



26
27
28
29
30
31
32
# File 'lib/lepus/producers/config.rb', line 26

def assign(options = {})
  options.each do |key, value|
    raise ArgumentError, "Unknown attribute #{key}" unless respond_to?(:"#{key}=")

    public_send(:"#{key}=", value)
  end
end