class ConfidentialInfoManager::JSON

Public Instance Methods

load(file_path) click to toggle source

JSON file load @param [String] file_path @return [Hash]

# File lib/confidential_info_manager/json.rb, line 20
def load(file_path)
  decrypt_only_value(::JSON.parse(File.read(file_path), { symbolize_names: true }))
end
save(secret_data, file_path) click to toggle source

JSON file save @param [Object] secret_data

@note Object is a String or Array or Hash

@param [String] file_path

# File lib/confidential_info_manager/json.rb, line 12
def save(secret_data, file_path)
  File.open(file_path, "w") { |file| file.write(::JSON.pretty_generate(encrypt_only_value(secret_data))) }
end