Class: AIPP::Environment::Config

Inherits:
Cache
  • Object
show all
Defined in:
lib/aipp/environment.rb

Overview

Config read from config.yml file

Instance Method Summary collapse

Methods inherited from Cache

#[], #merge, #replace

Instance Method Details

#read!(file) ⇒ Object



65
66
67
68
# File 'lib/aipp/environment.rb', line 65

def read!(file)
  @table = YAML.safe_load_file(file, symbolize_names: true, fallback: {}) if file.exist?
  @table[:namespace] ||= SecureRandom.uuid
end

#write!(file) ⇒ Object



70
71
72
# File 'lib/aipp/environment.rb', line 70

def write!(file)
  File.write(file, @table.transform_keys(&:to_s).to_yaml)
end