Class: Gru::Configuration
- Inherits:
-
Object
- Object
- Gru::Configuration
- Defined in:
- lib/gru/configuration.rb
Instance Attribute Summary collapse
-
#adapter ⇒ Object
readonly
Returns the value of attribute adapter.
-
#cluster_maximums ⇒ Object
readonly
Returns the value of attribute cluster_maximums.
-
#cluster_name ⇒ Object
readonly
Returns the value of attribute cluster_name.
-
#environment_name ⇒ Object
readonly
Returns the value of attribute environment_name.
-
#host_maximums ⇒ Object
readonly
Returns the value of attribute host_maximums.
-
#rebalance_flag ⇒ Object
readonly
Returns the value of attribute rebalance_flag.
Instance Method Summary collapse
-
#initialize(settings) ⇒ Configuration
constructor
A new instance of Configuration.
Constructor Details
#initialize(settings) ⇒ Configuration
Returns a new instance of Configuration.
7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/gru/configuration.rb', line 7 def initialize(settings) @host_maximums = settings.delete(:host_maximums) || settings.delete(:cluster_maximums) @cluster_maximums = settings.delete(:cluster_maximums) || @host_maximums @rebalance_flag = settings.delete(:rebalance_flag) || false @cluster_name = settings.delete(:cluster_name) || 'default' @environment_name = settings.delete(:environment_name) || 'default' client = initialize_client(settings.delete(:redis_config)) @adapter = Gru::Adapters::RedisAdapter.new(client,self) if @cluster_maximums.nil? raise ArgumentError "Need at least a cluster configuration" end end |
Instance Attribute Details
#adapter ⇒ Object (readonly)
Returns the value of attribute adapter.
6 7 8 |
# File 'lib/gru/configuration.rb', line 6 def adapter @adapter end |
#cluster_maximums ⇒ Object (readonly)
Returns the value of attribute cluster_maximums.
6 7 8 |
# File 'lib/gru/configuration.rb', line 6 def cluster_maximums @cluster_maximums end |
#cluster_name ⇒ Object (readonly)
Returns the value of attribute cluster_name.
6 7 8 |
# File 'lib/gru/configuration.rb', line 6 def cluster_name @cluster_name end |
#environment_name ⇒ Object (readonly)
Returns the value of attribute environment_name.
6 7 8 |
# File 'lib/gru/configuration.rb', line 6 def environment_name @environment_name end |
#host_maximums ⇒ Object (readonly)
Returns the value of attribute host_maximums.
6 7 8 |
# File 'lib/gru/configuration.rb', line 6 def host_maximums @host_maximums end |
#rebalance_flag ⇒ Object (readonly)
Returns the value of attribute rebalance_flag.
6 7 8 |
# File 'lib/gru/configuration.rb', line 6 def rebalance_flag @rebalance_flag end |