class EasyConf::Lookup::Yaml

Public Class Methods

read(key) click to toggle source
# File lib/easy_conf/lookup/yaml.rb, line 30
def read(key)
  value = dict[key.to_s]
  !value.nil? && commit(value)
end

Private Class Methods

config_files() click to toggle source
# File lib/easy_conf/lookup/yaml.rb, line 53
def config_files
  EasyConf.configuration.yaml.config_files.to_a
end
dict() click to toggle source
# File lib/easy_conf/lookup/yaml.rb, line 36
def dict
  @dict ||= read_config_files
end
read_config_file(config_file) click to toggle source
# File lib/easy_conf/lookup/yaml.rb, line 48
def read_config_file(config_file)
  content = YAML.load_file(config_file)
  scope ? content[scope] : content
end
read_config_files() click to toggle source
# File lib/easy_conf/lookup/yaml.rb, line 40
def read_config_files
  config_files.reduce({}) do |memo, config_file|
    read_config_file(config_file).each { |k, v| memo[k.to_s] = v }

    memo
  end
end
scope() click to toggle source
# File lib/easy_conf/lookup/yaml.rb, line 57
def scope
  EasyConf.configuration.yaml.scope
end