Class: EbisuConnection::Config

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/ebisu_connection/config.rb

Class Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(spec_name) ⇒ Config

Returns a new instance of Config.



31
32
33
# File 'lib/ebisu_connection/config.rb', line 31

def initialize(spec_name)
  @conf = load_config(spec_name)
end

Class Attribute Details

.replica_file=(value) ⇒ Object

Sets the attribute replica_file

Parameters:

  • value

    the value to set the attribute replica_file to.



8
9
10
# File 'lib/ebisu_connection/config.rb', line 8

def replica_file=(value)
  @replica_file = value
end

Class Method Details

.configObject



10
11
12
13
14
15
# File 'lib/ebisu_connection/config.rb', line 10

def config
  return @config if defined?(@config)

  conf = YAML.load_file(replica_file)
  @config = conf[EbisuConnection.env.to_s] || {}
end

Instance Method Details

#each(&block) ⇒ Object



35
36
37
# File 'lib/ebisu_connection/config.rb', line 35

def each(&block)
  @conf.each(&block)
end