Class: Emb::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/emb/configuration.rb

Constant Summary collapse

OPTIONS =
%i[
  host port url pool batch driver protocol
  connect_timeout read_timeout write_timeout reconnect_attempts
].freeze

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/emb/configuration.rb', line 12

def initialize
  self.host = 'localhost'
  self.port = 6379
  self.url = nil
  self.pool = 5
  self.batch = true
  self.driver = nil
  self.protocol = 2
  self.connect_timeout = nil
  self.read_timeout = nil
  self.write_timeout = nil
  self.reconnect_attempts = 3
end

Instance Method Details

#to_hObject



26
27
28
# File 'lib/emb/configuration.rb', line 26

def to_h
  OPTIONS.to_h { |key| [key, public_send(key)] }
end