Sha256: b34d56b74c82d644cbff1dd5273dc4d77c8211940d26fc657a1d3b4302e78012

Contents?: true

Size: 1.55 KB

Versions: 1

Compression:

Stored size: 1.55 KB

Contents

# frozen_string_literal: true

module ConvenientService
  module Service
    module Plugins
      module CanHaveSteps
        module Entities
          class Method
            module Commands
              ##
              # TODO: Abstract factory.
              #
              class CastMethod < Support::Command
                attr_reader :other, :options

                def initialize(other:, options:)
                  @other = other
                  @options = options
                end

                def call
                  return unless key
                  return unless name
                  return unless caller
                  return unless direction

                  ##
                  # https://en.wikipedia.org/wiki/Composition_over_inheritance
                  #
                  Method.new(key: key, name: name, caller: caller, direction: direction)
                end

                private

                def key
                  @key ||= Commands::CastMethodKey.call(other: other, options: options)
                end

                def name
                  @name ||= Commands::CastMethodName.call(other: other, options: options)
                end

                def caller
                  @caller ||= Commands::CastMethodCaller.call(other: other, options: options)
                end

                def direction
                  @direction ||= Commands::CastMethodDirection.call(other: other, options: options)
                end
              end
            end
          end
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
convenient_service-0.11.0 lib/convenient_service/service/plugins/can_have_steps/entities/method/commands/cast_method.rb