class UtilFile

Overview

This class provides functionality for storing data in utility files, such as config and data.

Included Modules

Direct Known Subclasses

Defined in:

util_file.cr

Constructors

Class Method Summary

Instance Method Summary

Constructor Detail

def self.new(ctx : YAML::ParseContext, node : YAML::Nodes::Node) #

[View source]

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.


[View source]

Instance Method Detail

def dir_name : String | Nil #

[View source]
def dir_name=(dir_name : String | Nil) #

[View source]
def file_name : String | Nil #

[View source]
def file_name=(file_name : String | Nil) #

[View source]
def filepath #

Returns the filepath, which is just a concatenation of the directory and filename.


[View source]
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.


[View source]