Method: SafeDb::DataMap#write
- Defined in:
- lib/utils/store/datamap.rb
#write(section_name, key, value) ⇒ Object
Write the key/value pair in the parameter into this key/value store’s backing INI file.
This method assumes the existence of the backing configuration file at the @file_path instance variable that was set during initialization.
Observable value is the written key/value pair within the specified section. The alternate flows are
-
if the section does not exist it is created
-
if the section and key exist the value is inserted or overwritten
134 135 136 137 138 139 140 141 |
# File 'lib/utils/store/datamap.rb', line 134 def write( section_name, key, value ) data_map = IniFile.new( :filename => @file_path, :encoding => 'UTF-8' ) data_map = IniFile.load( @file_path ) if File.file? @file_path data_map[section_name][key] = value data_map.write end |