Sha256: fdcfa45a6fd8a007ceca4e659c7dcfea742b86f29086c0db4ef8e61d65cf9c80
Contents?: true
Size: 1.53 KB
Versions: 5
Compression:
Stored size: 1.53 KB
Contents
# frozen_string_literal: true module ConvenientService module Service module Plugins module HasResultSteps module Entities class Method module Commands class DefineMethodInContainer < Support::Command include Support::Delegate attr_reader :method, :container, :index delegate :key, :name, to: :method def initialize(method:, container:, index:) @method = method @container = container @index = index end def call ## # NOTE: Assignement in the beginning for easier debugging. # <<~RUBY.tap { |code| container.klass.class_eval(code, __FILE__, __LINE__ + 1) } def #{name} step, key, name, error = steps[#{index}], :#{key}, :#{name}, #{error} return step.result.data[key] if step.completed? raise ::#{error}.new(step: step, method_name: name) end RUBY true end private def error @error ||= <<~RUBY.chomp ConvenientService::Service::Plugins::HasResultSteps::Entities::Method::Errors::NotCompletedStep RUBY end end end end end end end end end
Version data entries
5 entries across 5 versions & 1 rubygems