Sha256: bdc2759a1df92677ea3ea0b011a5f1564086a5cc74fd93465bbb7caf5d7b568d

Contents?: true

Size: 1.55 KB

Versions: 6

Compression:

Stored size: 1.55 KB

Contents

# frozen_string_literal: true

module ConvenientService
  module Service
    module Plugins
      module HasResultSteps
        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

6 entries across 6 versions & 1 rubygems

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