Module: Flows::Plugin::DependencyInjector::InitializePatch Private

Defined in:
lib/flows/plugin/dependency_injector.rb

Overview

This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.

Since:

  • 0.4.0

Instance Method Summary collapse

Instance Method Details

#initialize(*args, **kwargs, &block) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

rubocop:disable Metrics/MethodLength

Since:

  • 0.4.0



138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
# File 'lib/flows/plugin/dependency_injector.rb', line 138

def initialize(*args, **kwargs, &block) # rubocop:disable Metrics/MethodLength
  klass = self.class
  DependencyList.new(
    klass: klass,
    definitions: klass.dependencies,
    provided_values: kwargs[:dependencies].dup || {}
  ).inject_to(self)

  filtered_kwargs = kwargs.reject { |key, _| key == :dependencies }

  if filtered_kwargs.empty? # https://bugs.ruby-lang.org/issues/14415
    super(*args, &block)
  else
    super(*args, **filtered_kwargs, &block)
  end
end