Sha256: f558a4bc7d005a9413c384c2e964a9c68b4e74057b82967059e5e0ef5f970edd

Contents?: true

Size: 1.21 KB

Versions: 3

Compression:

Stored size: 1.21 KB

Contents

# frozen_string_literal: true

require_relative "has_j_send_result/concern"
require_relative "has_j_send_result/constants"
require_relative "has_j_send_result/container"
require_relative "has_j_send_result/commands"
require_relative "has_j_send_result/entities"

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

Version data entries

3 entries across 3 versions & 1 rubygems

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