mirror of
https://github.com/hkalexling/Mango.git
synced 2026-03-20 00:00:48 -04:00
Use macro to DRY the self.default method
This commit is contained in:
@@ -45,3 +45,12 @@ struct Nil
|
||||
other
|
||||
end
|
||||
end
|
||||
|
||||
macro use_default
|
||||
def self.default : self
|
||||
unless @@default
|
||||
@@default = new
|
||||
end
|
||||
@@default.not_nil!
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user