Sha256: 0df58afd3e535982ecb52a87d4b4832bcec804511b9f094c18bdcc2c4b1eb1e3
Contents?: true
Size: 1.86 KB
Versions: 11
Compression:
Stored size: 1.86 KB
Contents
# frozen_string_literal: true module ConvenientService module Service module Plugins module HasResultSteps module Commands class CreateStepClass < Support::Command attr_reader :service_class def initialize(service_class:) @service_class = service_class end def call step_class.include Entities::Step::Concern ## # class Step < ConvenientService::Service::Plugins::HasResultSteps::Entities::Step # or just `class Step` if service class defines its own. # include ConvenientService::Service::Plugins::HasResultSteps::Entities::Step::Concern # # class << self # def service_class # ## # # NOTE: Returns `service_class` passed to `CreateResultClass`. # # # service_class # end # # def ==(other) # return unless other.instance_of?(self.class) # # self.service_class == other.service_class # end # end # end # step_class.class_exec(service_class) do |service_class| define_singleton_method(:service_class) { service_class } ## # TODO: Fix a bug with `ap`. # define_singleton_method(:==) { |other| self.service_class == other.service_class if other.instance_of?(self.class) } end step_class end private def step_class @step_class ||= Utils::Module.get_own_const(service_class, :Step) || ::Class.new(Entities::Step) end end end end end end end
Version data entries
11 entries across 11 versions & 1 rubygems