Method: Files.write_properties

Defined in:
lib/opensecret/plugins.io/file/file.rb

.write_properties(properties_map, props_dir_path, props_filename) ⇒ Object

– – Write the 1D key/value map into a properties – file at the parameter folder. – – Parameters – properties_map : the key/value map to serialize – props_dir_path : folder holding new properties file – props_filename : name of the new properties file – – Dependencies and Assumptions – the directory will be created if it does not exist – we assume the properties file DOES NOT EXIST – the map is 1D and is not nil (can be empty) – the directory is writeable by the user –



420
421
422
423
424
425
426
427
428
# File 'lib/opensecret/plugins.io/file/file.rb', line 420

def self.write_properties properties_map, props_dir_path, props_filename

  Dir.mkdir props_dir_path unless File.exists? props_dir_path
  prop_filepath = File.join props_dir_path, props_filename
  File.write prop_filepath, to_properties_text(properties_map)

  LogObject.file prop_filepath, "write properties"

end