class Idcf::Cli::Lib::Util::YmlConf
yml conf
Attributes
data[R]
load_data[R]
Public Class Methods
load(path)
click to toggle source
# File lib/idcf/cli/lib/util/yml_conf.rb, line 12 def load(path) @data ||= {} return @data[path] unless @data[path].nil? @data[path] = name.constantize.new(path) @data[path] end
new(*path)
click to toggle source
initialize
@param path [String] yml file path
# File lib/idcf/cli/lib/util/yml_conf.rb, line 23 def initialize(*path) @load_data = YAML.load_file(path[0]) end
Public Instance Methods
find(path)
click to toggle source
get config value
@param path [String] @param section [String] @return String or Hash @raise
# File lib/idcf/cli/lib/util/yml_conf.rb, line 33 def find(path) result = @load_data return result[path] if path.class == Symbol path.split('.').each do |name| result = result.fetch(name) end result rescue StandardError => _e raise Idcf::Cli::Error::CliError, "Error: could not read '#{path}'" end