Skip to content

Instantly share code, notes, and snippets.

@flash-gordon
Created May 18, 2016 09:43
Show Gist options
  • Save flash-gordon/3378dc8188fe19592584e89c84efc3a0 to your computer and use it in GitHub Desktop.
Save flash-gordon/3378dc8188fe19592584e89c84efc3a0 to your computer and use it in GitHub Desktop.
module Imprint
Import = Dry::AutoInject(Container)
KwargsImport = Import.kwargs
class << self
def inject(target)
-> *values { target.send(:include, KwargsImport[*values]) }
end
def args_inject(target)
-> *values { target.send(:include, Import[*values]) }
end
end
module Mixin
def container
Imprint::Container
end
def inject
Imprint.inject(self)
end
def args_inject
Imprint.args_inject(self)
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment