Class: Dry::Transaction::OperationResolver
- Inherits:
-
Module
- Object
- Module
- Dry::Transaction::OperationResolver
- Defined in:
- lib/dry/transaction/operation_resolver.rb
Instance Method Summary collapse
-
#initialize(container) ⇒ OperationResolver
constructor
A new instance of OperationResolver.
Constructor Details
#initialize(container) ⇒ OperationResolver
Returns a new instance of OperationResolver.
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/dry/transaction/operation_resolver.rb', line 6 def initialize(container) module_exec(container) do |ops_container| define_method :initialize do |**kwargs| operation_kwargs = self.class.steps.select(&:operation_name).to_h { |step| operation = kwargs.fetch(step.name) { if ops_container&.key?(step.operation_name) ops_container[step.operation_name] else nil end } [step.name, operation] } super(**kwargs, **operation_kwargs) end end end |