class UtilFile
- UtilFile
- Reference
- Object
Overview
This class provides functionality for storing data in utility files, such as config and data.
Included Modules
- YAML::Serializable
Direct Known Subclasses
Defined in:
util_file.crConstructors
Class Method Summary
-
.load(dir_name, file_name)
Attempts to read the yml from disk at the specified filepath.
Instance Method Summary
- #dir_name : String | Nil
- #dir_name=(dir_name : String | Nil)
- #file_name : String | Nil
- #file_name=(file_name : String | Nil)
-
#filepath
Returns the filepath, which is just a concatenation of the directory and filename.
-
#save
Serializes the UtilFile and writes it out to the specified filepath.
Constructor Detail
Class Method Detail
def self.load(dir_name, file_name)
#
Attempts to read the yml from disk at the specified filepath. If there is no file there, nothing will be read, and the defaults (which should be implemented in classes extending UtilFile) will not be changed.
Instance Method Detail
def save
#
Serializes the UtilFile and writes it out to the specified filepath. If the directory specified does not exist, it will be created before writing. Similarly, the file will be created if it doesn't exist.