class EasyConfig::ConfigFile
Attributes
name[R]
Public Class Methods
all()
click to toggle source
# File lib/easy_config/config_file.rb, line 30 def all @all ||= load_all end
new(path)
click to toggle source
# File lib/easy_config/config_file.rb, line 6 def initialize(path) @path = path @name = File.basename(path, '.*').to_sym end
reset!()
click to toggle source
# File lib/easy_config/config_file.rb, line 34 def reset! @all = nil end
Private Class Methods
load_all()
click to toggle source
# File lib/easy_config/config_file.rb, line 39 def load_all all = [] EasyConfig::PathResolver.config_paths.each do |config_path| Dir.glob(File.join(config_path, '*.yml')).each do |yaml_file| all << EasyConfig::ConfigFile.new(yaml_file) end end all end
Public Instance Methods
configuration()
click to toggle source
# File lib/easy_config/config_file.rb, line 11 def configuration @configuration ||= create_configuration end
create_configuration()
click to toggle source
# File lib/easy_config/config_file.rb, line 15 def create_configuration yaml = yaml_data yaml = yaml[EasyConfig::Env.current] if EasyConfig::Env.has_environment?(yaml) EasyConfig::Configuration.new(yaml) end
yaml_data()
click to toggle source
# File lib/easy_config/config_file.rb, line 23 def yaml_data input = File.read(@path) eruby = ERB.new(input) YAML.load(eruby.result) end