class Gmaps::ConfigLoader
- Gmaps::ConfigLoader
- Reference
- Object
Defined in:
gmaps/config.crConstructors
-
.new(config_dir : String | Nil = nil)
Constructor Initializes the API key and sets up the config directory and file path
Class Method Summary
-
.config_dir_exists?(config_dir : String | Nil = nil) : Bool
does config_dir exist?
-
.get_config_dir(config_dir : String | Nil = nil) : Path
Determines the default configuration directory based on environment variables or a fallback
Instance Method Summary
-
#config_dir : Path
Getter for the configuration directory path
-
#config_file : Path
Getter for the configuration file path
-
#config_file_exists?
Checks if the config file exists
-
#edit_key(api_key : String)
Edits the API key stored in the config file
-
#get_key
Retrieves the API key from the config file
-
#get_key?
Retrieves the API key from the config file, returning nil if not found
-
#keyfile : Path
Getter for the keyfile path
-
#open_config_file
Opens the config file for editing using the default editor or the EDITOR environment variable
- #secrets_class
- #to_yaml
- #yaml_config
Constructor Detail
Constructor Initializes the API key and sets up the config directory and file path
Params:
- config_dir (String?) - Optional custom configuration directory path
Class Method Detail
Determines the default configuration directory based on environment variables or a fallback
Returns:
- (Path) - The configuration directory path
Instance Method Detail
Edits the API key stored in the config file
Params:
- api_key (String) - The new API key to store
Retrieves the API key from the config file, returning nil if not found
Returns:
- (String | Nil) - The API key or nil if not found
Opens the config file for editing using the default editor or the EDITOR environment variable