Class: Bluster::ClusterConfig

Inherits:
Object
  • Object
show all
Defined in:
lib/bluster/cluster_config.rb

Constant Summary collapse

SET_PREFIX =
'set'.freeze
UNDERSCORE =
'_'.freeze
PREFIXES =
{
  soft_handoff: 'set_use',
  smart_balancing: 'use'
}.freeze

Class Method Summary collapse

Class Method Details

.create(options = {}) ⇒ Object



5
6
7
8
9
10
11
12
13
# File 'lib/bluster/cluster_config.rb', line 5

def self.create(options = {})
  config = Ordasity::ClusterConfig.new

  options.each do |option, value|
    config.send(wrap_with_prefix(option), value)
  end

  config
end

.prefix_for(option) ⇒ Object



19
20
21
# File 'lib/bluster/cluster_config.rb', line 19

def self.prefix_for(option)
  PREFIXES[option] || SET_PREFIX
end

.wrap_with_prefix(option) ⇒ Object



15
16
17
# File 'lib/bluster/cluster_config.rb', line 15

def self.wrap_with_prefix(option)
  [prefix_for(option), option].join(UNDERSCORE).to_sym
end