mirror of
https://github.com/hkalexling/Mango.git
synced 2026-04-05 00:00:44 -04:00
Use macro to DRY the self.default method
This commit is contained in:
@@ -131,12 +131,7 @@ module MangaDex
|
||||
end
|
||||
|
||||
class API
|
||||
def self.default : self
|
||||
unless @@default
|
||||
@@default = new
|
||||
end
|
||||
@@default.not_nil!
|
||||
end
|
||||
use_default
|
||||
|
||||
def initialize
|
||||
@base_url = Config.current.mangadex["api_url"].to_s ||
|
||||
|
||||
@@ -7,12 +7,7 @@ module MangaDex
|
||||
.to_i32
|
||||
@retries : Int32 = Config.current.mangadex["download_retries"].to_i32
|
||||
|
||||
def self.default : self
|
||||
unless @@default
|
||||
@@default = new
|
||||
end
|
||||
@@default.not_nil!
|
||||
end
|
||||
use_default
|
||||
|
||||
def initialize
|
||||
super
|
||||
|
||||
Reference in New Issue
Block a user