Class: EY::Config::Local
- Inherits:
-
Object
- Object
- EY::Config::Local
- Defined in:
- lib/ey_config/local.rb
Class Method Summary collapse
Class Method Details
.config_path ⇒ Object
7 8 9 |
# File 'lib/ey_config/local.rb', line 7 def config_path 'config/ey_services_config_local.yml' end |
.existing_contents ⇒ Object
28 29 30 31 32 |
# File 'lib/ey_config/local.rb', line 28 def existing_contents YAML.load_file(config_path) rescue Errno::ENOENT {} end |
.generate(*args) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/ey_config/local.rb', line 11 def generate(*args) contents = existing_contents contents = {} unless contents.is_a?(Hash) tmp = contents args[0 ... -1].each do |arg| tmp[arg] ||= {} tmp = tmp[arg] end tmp[args.last] = 'SAMPLE' FileUtils.mkdir_p('config') File.open(config_path, 'w') do |f| f.print YAML.dump(contents) end end |