Module: Aws::Session::Credentials::FileProvider::IniFileProvider

Included in:
CredentialFile
Defined in:
lib/aws/session/credentials/file_provider/ini_file_provider.rb

Overview

Mixin to store configuration in an INI file

Instance Method Summary collapse

Instance Method Details

#[](key) ⇒ Object



7
8
9
# File 'lib/aws/session/credentials/file_provider/ini_file_provider.rb', line 7

def [](key)
  read[key.to_s]
end

#[]=(key, value) ⇒ Object



11
12
13
14
15
# File 'lib/aws/session/credentials/file_provider/ini_file_provider.rb', line 11

def []=(key, value)
  ini_file = read
  ini_file[key.to_s] = value
  ini_file.save
end

#readIniFile

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (IniFile)


19
20
21
22
23
24
25
# File 'lib/aws/session/credentials/file_provider/ini_file_provider.rb', line 19

def read
  if File.exist?(path)
    IniFile.load(path)
  else
    IniFile.new(filename: path, encoding: 'UTF-8', permissions: 0600)
  end
end