Skip to content

Instantly share code, notes, and snippets.

@MatteoJoliveau
Created June 22, 2018 12:23
Show Gist options
  • Save MatteoJoliveau/5707696317e9764161732ad468701725 to your computer and use it in GitHub Desktop.
Save MatteoJoliveau/5707696317e9764161732ad468701725 to your computer and use it in GitHub Desktop.
A minimal POC to validate an IoC container in Crystal
abstract struct Any; end
record A(T) < Any, this : T
class What
def hello()
puts "Hello!"
end
end
container = {} of String => Any
container["test"] = A.new(What.new)
container["test"].this.hello
@MatteoJoliveau
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment