Use macro to DRY the self.default method

This commit is contained in:
Alex Ling
2020-07-21 12:33:50 +00:00
parent b75a838e14
commit 87b6e79952
9 changed files with 17 additions and 49 deletions

View File

@@ -92,12 +92,7 @@ class Queue
@downloaders = [] of Downloader
@paused = false
def self.default : self
unless @@default
@@default = new
end
@@default.not_nil!
end
use_default
def initialize(db_path : String? = nil)
@path = db_path || Config.current.mangadex["download_queue_db_path"].to_s