Class: Sponges::Configuration

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

Overview

This class concern is to provide a global object for configuration needs.

Constant Summary collapse

ACCESSOR =
[:worker_name, :worker, :logger, :size, :daemonize,
            :after_fork, :timeout, :gracefully, :store, :port,
            :polling, :env
]

Class Method Summary collapse

Class Method Details

.after_fork(&block) ⇒ Object



23
24
25
# File 'lib/sponges/configuration.rb', line 23

def after_fork(&block)
  Hook._after_fork = block
end

.configurationObject



17
18
19
20
21
# File 'lib/sponges/configuration.rb', line 17

def configuration
  ACCESSOR.each_with_object({}) do |conf, method|
    conf[method] = send(method)
  end
end

.configure {|_self| ... } ⇒ Object

Yields:

  • (_self)

Yield Parameters:



13
14
15
# File 'lib/sponges/configuration.rb', line 13

def configure
  yield self
end

.on_chld(&block) ⇒ Object



27
28
29
# File 'lib/sponges/configuration.rb', line 27

def on_chld(&block)
  Hook._on_chld = block
end

.poolingObject



35
36
37
# File 'lib/sponges/configuration.rb', line 35

def pooling
  @pooling || 60
end

.portObject



31
32
33
# File 'lib/sponges/configuration.rb', line 31

def port
  @port || 5032
end