Sha256: 22b1e64b2e70ef0828eb4874d00a139718d58ec6e8e85c850cfb8556ceb8be2d
Contents?: true
Size: 1.41 KB
Versions: 12
Compression:
Stored size: 1.41 KB
Contents
# frozen_string_literal: true module Mutant # Isolation mechanism class Isolation include AbstractType # Isolated computation result class Result include AbstractType, Adamantium NULL_LOG = '' private_constant(*constants(false)) abstract_method :error abstract_method :next abstract_method :value # Add error on top of current result # # @param [Result] error # # @return [Result] def add_error(error) ErrorChain.new(error, self) end # The log captured from integration # # @return [String] def log NULL_LOG end # Test for success # # @return [Boolean] def success? instance_of?(Success) end # Succesful result producing value class Success < self include Concord::Public.new(:value, :log) def self.new(_value, _log = '') super end end # Success # Unsuccessful result by unexpected exception class Exception < self include Concord::Public.new(:value) end # Error # Result when there where many results class ErrorChain < Result include Concord::Public.new(:value, :next) end # ChainError end # Result # Call block in isolation # # @return [Result] # the blocks result abstract_method :call end # Isolation end # Mutant
Version data entries
12 entries across 12 versions & 1 rubygems