Sha256: 202a06b90d9dea6dc419c3f9291009259dcca5c6636ec5a3d25f8222fb26ec69

Contents?: true

Size: 1.55 KB

Versions: 3

Compression:

Stored size: 1.55 KB

Contents

# frozen_string_literal: true

module ConvenientService
  module Service
    module Plugins
      module CanHaveSteps
        module Entities
          class Method
            module Entities
              module Callers
                class Reassignment < Callers::Base
                  def reassignment?(name)
                    ##
                    # TODO: A better name for `object`. Wrapped object, `target`?
                    #
                    object.to_sym == name.to_sym
                  end

                  ##
                  # TODO: Separate `in` and `out` methods?
                  #
                  def calculate_value(method)
                    ::ConvenientService.raise Exceptions::CallerCanNotCalculateReassignment.new(method: method)
                  end

                  def validate_as_input_for_container!(container, method:)
                    ::ConvenientService.raise Exceptions::InputMethodReassignment.new(method: method, container: container)
                  end

                  def validate_as_output_for_container!(container, method:)
                    ##
                    # TODO: Raise when container has two reassignments with same name.
                    #
                    true
                  end

                  def define_output_in_container!(container, index:, method:)
                    Commands::DefineMethodInContainer.call(method: method, container: container, index: index)
                  end
                end
              end
            end
          end
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
convenient_service-0.19.1 lib/convenient_service/service/plugins/can_have_steps/entities/method/entities/callers/reassignment.rb
convenient_service-0.19.0 lib/convenient_service/service/plugins/can_have_steps/entities/method/entities/callers/reassignment.rb
convenient_service-0.18.0 lib/convenient_service/service/plugins/can_have_steps/entities/method/entities/callers/reassignment.rb