Class: ConfigLoader

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(config_string) ⇒ ConfigLoader

Returns a new instance of ConfigLoader.



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

def initialize(config_string)
  @config_params = YAML::load(config_string)
end

Instance Attribute Details

#config_paramsObject

Returns the value of attribute config_params.



6
7
8
# File 'lib/config_loader.rb', line 6

def config_params
  @config_params
end

Instance Method Details

#serversObject

Treat servers like each. I would have used the name each, but I wanted to give the user some idea of what information they should be getting.



16
17
18
19
20
21
22
23
# File 'lib/config_loader.rb', line 16

def servers
  server_list = @config_params
  
  server_list.each do |i|
    yield i
  end
  
end