Class: ConfidentialInfoManager::YAML

Inherits:
Core
  • Object
show all
Defined in:
lib/confidential_info_manager/yaml.rb

Constant Summary

Constants inherited from Core

Core::ITERATOR_COUNT, Core::RANDOM_BYTES

Instance Method Summary collapse

Methods inherited from Core

#decrypt, #decrypt_only_value, #encrypt, #encrypt_only_value, generate_salt, #initialize

Constructor Details

This class inherits a constructor from ConfidentialInfoManager::Core

Instance Method Details

#load(file_path) ⇒ Hash

YAML file load

Parameters:

  • file_path (String)

Returns:

  • (Hash)


20
21
22
# File 'lib/confidential_info_manager/yaml.rb', line 20

def load(file_path)
  decrypt_only_value(::YAML.load(File.read(file_path)))
end

#save(secret_data, file_path) ⇒ Object

YAML file save

Parameters:

  • secret_data (Object)

    @note Object is a String or Array or Hash

  • file_path (String)


12
13
14
# File 'lib/confidential_info_manager/yaml.rb', line 12

def save(secret_data, file_path)
  File.open(file_path, "w") { |file| ::YAML.dump(encrypt_only_value(secret_data), file) }
end