Class: ConsulLoader::ConfigParser

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfigParser

Returns a new instance of ConfigParser.



5
6
7
# File 'lib/consul_loader/config_parser.rb', line 5

def initialize
  self.config = []
end

Instance Attribute Details

#configObject

Returns the value of attribute config.



3
4
5
# File 'lib/consul_loader/config_parser.rb', line 3

def config
  @config
end

Instance Method Details

#process_yaml(root, hash) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/consul_loader/config_parser.rb', line 9

def process_yaml root, hash
  keys = []
  return [] unless hash

  hash.each do |key, value|
    if value.is_a?(Hash)
      process_yaml(root + "/" + key, value).each do |k|
        keys << k
      end
    else
      keys << {:k => root + "/" + key, :v => value}
    end
  end
  return keys
end