-
Notifications
You must be signed in to change notification settings - Fork 9
Macro::Inject
Vladislav Trotsenko edited this page Apr 10, 2020
·
2 revisions
Provides to set dependency injection in operations.
class Container
extend Dry::Container::Mixin
namespace 'some_namespace' { register('some_dependency') { SomeDependency } }
end
class SomeOperation < ApplicationOperation
step Macro::Inject(some_dependency: 'some_namespace.some_dependency') # ctx[:some_dependency] = SomeDependency
end
class SomeOperation < ApplicationOperation
step Macro::Inject(some_dependency: SomeDependency, other_dependency: OtherDependency)
# ctx[:some_dependency], ctx[:other_dependency] = SomeDependency, OtherDependency
end
class SomeOperation < ApplicationOperation
step Macro::Inject(some_dependency: 'some_namespace.some_dependency', other_dependency: OtherDependency)
# ctx[:some_dependency], ctx[:other_dependency] = SomeDependency, OtherDependency
end
RubyGarage is a leading software development and consulting company in Eastern Europe. Our main expertise includes Ruby and Ruby on Rails, but we successfully employ other technologies to deliver the best results to our clients. Check out our portfolio for even more exciting works!