Sha256: 450bb18d02fc22a066ab891c160044a20332efdfdd8329c08dacdb8ca951e5b7

Contents?: true

Size: 1.13 KB

Versions: 2

Compression:

Stored size: 1.13 KB

Contents

# frozen_string_literal: true

require_relative "can_have_steps/commands"
require_relative "can_have_steps/concern"
require_relative "can_have_steps/entities"

module ConvenientService
  module Service
    module Plugins
      module CanHaveSteps
        class << self
          ##
          # Checks whether an object is a step instance.
          #
          # @api public
          #
          # @param step [Object] Can be any type.
          # @return [Boolean]
          #
          # @example Simple usage.
          #   class Service
          #     include ConvenientService::Standard::Config
          #
          #     step :result
          #
          #     def result
          #       success
          #     end
          #   end
          #
          #   step = Service.new.steps.first
          #
          #   ConvenientService::Plugins::Service::CanHaveSteps.step?(step)
          #   # => true
          #
          #   ConvenientService::Plugins::Service::CanHaveSteps.step?(42)
          #   # => false
          #
          def step?(step)
            Commands::IsStep[step: step]
          end
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
convenient_service-0.19.1 lib/convenient_service/service/plugins/can_have_steps.rb
convenient_service-0.19.0 lib/convenient_service/service/plugins/can_have_steps.rb