Sha256: 695704a1b8fc4c8432edfc61ed868c1b8e261b980d612f905d4ff08c2b6ebebb

Contents?: true

Size: 1.94 KB

Versions: 1

Compression:

Stored size: 1.94 KB

Contents

# frozen_string_literal: true

module ConvenientService
  module Service
    module Plugins
      module CanHaveSteps
        module Entities
          class Step
            module Plugins
              module CanHaveFallback
                module Concern
                  include Support::Concern

                  instance_methods do
                    ##
                    # @return [Bool]
                    #
                    def fallback_step?
                      Utils.to_bool(params.extra_kwargs[:fallback])
                    end

                    ##
                    # @return [ConvenientService::Service::Plugins::HasJSendResult::Entities::Result]
                    # @raise [ConvenientService::Service::Plugins::CanHaveSteps::Entities::Step::Exceptions::StepHasNoOrganizer]
                    #
                    # @note `service_fallback_result` has middlewares.
                    #
                    # @internal
                    #   IMPORTANT: `service.klass.fallback_result(**input_values)` is the reason, why services should have only kwargs as arguments.
                    #   TODO: Extract `StepDefinition`. This way `has_organizer?` check can be avoided completely.
                    #
                    def service_fallback_result
                      service.klass.fallback_result(**input_values)
                    end

                    ##
                    # @return [ConvenientService::Service::Plugins::HasJSendResult::Entities::Result]
                    # @raise [ConvenientService::Service::Plugins::CanHaveSteps::Entities::Step::Exceptions::StepHasNoOrganizer]
                    # @note `fallback_result` has middlewares.
                    #
                    def fallback_result
                      convert_to_step_result(service_fallback_result)
                    end
                  end
                end
              end
            end
          end
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
convenient_service-0.13.0 lib/convenient_service/service/plugins/can_have_steps/entities/step/plugins/can_have_fallback/concern.rb