Module: Gruf::Balancer::Configuration
- Included in:
- Gruf::Balancer
- Defined in:
- lib/gruf/balancer/configuration.rb
Overview
Represents configuration settings for the system
Constant Summary collapse
- VALID_CONFIG_KEYS =
{}.freeze
Class Method Summary collapse
-
.extended(base) ⇒ Object
Whenever this is extended into a class, setup the defaults.
Instance Method Summary collapse
-
#configure {|_self| ... } ⇒ Gruf::Balancer::Configuration
Yield self for ruby-style initialization.
-
#options ⇒ Hash
Return the current configuration options as a Hash.
-
#reset ⇒ Hash
Set the default configuration onto the extended class.
Class Method Details
.extended(base) ⇒ Object
Whenever this is extended into a class, setup the defaults
31 32 33 |
# File 'lib/gruf/balancer/configuration.rb', line 31 def self.extended(base) base.reset end |
Instance Method Details
#configure {|_self| ... } ⇒ Gruf::Balancer::Configuration
Yield self for ruby-style initialization
41 42 43 |
# File 'lib/gruf/balancer/configuration.rb', line 41 def configure yield self end |
#options ⇒ Hash
Return the current configuration options as a Hash
50 51 52 53 54 55 56 |
# File 'lib/gruf/balancer/configuration.rb', line 50 def opts = {} VALID_CONFIG_KEYS.each_key do |k| opts.merge!(k => send(k)) end opts end |
#reset ⇒ Hash
Set the default configuration onto the extended class
63 64 65 66 67 68 |
# File 'lib/gruf/balancer/configuration.rb', line 63 def reset VALID_CONFIG_KEYS.each do |k, v| send("#{k}=", v) end end |