Class: ConsulLoader::ConfigParser
- Inherits:
-
Object
- Object
- ConsulLoader::ConfigParser
- Defined in:
- lib/consul_loader/config_parser.rb
Instance Attribute Summary collapse
-
#config ⇒ Object
Returns the value of attribute config.
Instance Method Summary collapse
-
#initialize ⇒ ConfigParser
constructor
A new instance of ConfigParser.
- #process_yaml(root, hash) ⇒ Object
Constructor Details
#initialize ⇒ ConfigParser
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
#config ⇒ Object
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 |