mirror of
https://github.com/hkalexling/Mango.git
synced 2026-04-05 00:00:44 -04:00
Use singleton in various classes
This commit is contained in:
@@ -26,6 +26,16 @@ class Config
|
||||
"manga_rename_rule" => "{title}",
|
||||
}
|
||||
|
||||
@@singlet : Config?
|
||||
|
||||
def self.current
|
||||
@@singlet.not_nil!
|
||||
end
|
||||
|
||||
def set_current
|
||||
@@singlet = self
|
||||
end
|
||||
|
||||
def self.load(path : String?)
|
||||
path = "~/.config/mango/config.yml" if path.nil?
|
||||
cfg_path = File.expand_path path, home: true
|
||||
|
||||
Reference in New Issue
Block a user