Last active
November 1, 2016 21:45
-
-
Save apotonick/63f449b02bd2b3cdbd446fd66e9df022 to your computer and use it in GitHub Desktop.
Auto_inject for TRB2
This file contains hidden or 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
my_container = Dry::Container.new | |
my_container.register(:user_repository, -> { Object }) | |
AutoInject = Dry::AutoInject(my_container) | |
class Create < Trailblazer::Operation | |
include AutoInject[:user_repository] | |
end | |
Create.(params, {}) | |
==> AutoInject overrides Create::call | |
def call(params, options, *dependencies) | |
super(params, options.merge(AUTOINJECT-MAGIC), *dependencies) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment