Created
July 9, 2017 11:36
-
-
Save Groogy/68bc858c648968abfa0abed474941f34 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
macro finished | |
{% for definition in Crystal::Clear::CLASS_COMPILE_DATA %} | |
class {{definition[0]}} | |
Crystal::Clear::CLASS_RUNTIME_DATA << Crystal::Clear::ClassData({{definition[0]}}).new() | |
def {{definition[1]}} | |
{% for condition in definition[2] %} | |
if(({{condition}}) == false) | |
raise Crystal::Clear::Exception.new("Failed {{definition[0]}} require contract: {{condition}}") | |
end | |
{% end %} | |
previous_def | |
{% for condition in definition[3] %} | |
if(({{condition}}) == false) | |
raise Crystal::Clear::Exception.new("Failed {{definition[0]}} ensure contract: {{condition}}") | |
end | |
{% end %} | |
end | |
end | |
{% end %} | |
end | |
puts Crystal::Clear::CLASS_RUNTIME_DATA |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment