Sha256: 3e9976404aa9f623dbc231db182e2890d3cbc5e1e611aa5bd9ae043e75c25b96

Contents?: true

Size: 1.55 KB

Versions: 6

Compression:

Stored size: 1.55 KB

Contents

# frozen_string_literal: true

require_relative "reassignment/commands"

module ConvenientService
  module Service
    module Plugins
      module HasResultSteps
        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 Errors::CallerCanNotCalculateReassignment.new(method: method)
                  end

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

6 entries across 6 versions & 1 rubygems

Version Path
convenient_service-0.10.1 lib/convenient_service/service/plugins/has_result_steps/entities/method/entities/callers/reassignment.rb
convenient_service-0.10.0 lib/convenient_service/service/plugins/has_result_steps/entities/method/entities/callers/reassignment.rb
convenient_service-0.9.0 lib/convenient_service/service/plugins/has_result_steps/entities/method/entities/callers/reassignment.rb
convenient_service-0.8.0 lib/convenient_service/service/plugins/has_result_steps/entities/method/entities/callers/reassignment.rb
convenient_service-0.7.0 lib/convenient_service/service/plugins/has_result_steps/entities/method/entities/callers/reassignment.rb
convenient_service-0.6.0 lib/convenient_service/service/plugins/has_result_steps/entities/method/entities/callers/reassignment.rb