-
-
Save botanicus/278b0741948238c2b10bee2248145abb 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
module DockerProjectManager | |
abstract class Command | |
def self.commands : Hash(String, self.class) | |
@@commands ||= Hash(String, self.class).new | |
end | |
macro inherited | |
command_class = {{ @type.name.id }} | |
command_name = "{{ @type.name.id }}".split("::").last.downcase | |
self.commands[command_name] = command_class | |
end | |
end | |
end | |
class DockerProjectManager::Bootstrap < DockerProjectManager::Command end |
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
Error in x.cr:15: expanding macro | |
class DockerProjectManager::Bootstrap < DockerProjectManager::Command end | |
^ | |
in macro 'inherited' /root/docker-project-manager/x.cr:7, line 3: | |
1. command_class = DockerProjectManager::Bootstrap | |
2. command_name = "DockerProjectManager::Bootstrap".split("::").last.downcase | |
> 3. self.commands[command_name] = command_class | |
4. | |
instantiating 'DockerProjectManager::Bootstrap.class#commands()' | |
in x.cr:3: type must be Hash(String, DockerProjectManager::Bootstrap.class), not (Hash(String, DockerProjectManager::Bootstrap.class) | Hash(String, DockerProjectManager::Command.class)) | |
def self.commands : Hash(String, self.class) | |
^~~~~~~~ | |
Rerun with --error-trace to show a complete error trace. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment