Sha256: d58b5b407923b571f87e9a75a8ddd5caf7580dbddfe8d0deec916ca3db747bfd

Contents?: true

Size: 1.56 KB

Versions: 4

Compression:

Stored size: 1.56 KB

Contents

# frozen_string_literal: true

require_relative "reassignment/commands"

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)
                    raise Exceptions::CallerCanNotCalculateReassignment.new(method: method)
                  end

                  def validate_as_input_for_container!(container, method:)
                    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

4 entries across 4 versions & 1 rubygems

Version Path
convenient_service-0.16.0 lib/convenient_service/service/plugins/can_have_steps/entities/method/entities/callers/reassignment.rb
convenient_service-0.15.0 lib/convenient_service/service/plugins/can_have_steps/entities/method/entities/callers/reassignment.rb
convenient_service-0.14.0 lib/convenient_service/service/plugins/can_have_steps/entities/method/entities/callers/reassignment.rb
convenient_service-0.13.0 lib/convenient_service/service/plugins/can_have_steps/entities/method/entities/callers/reassignment.rb