Class: Mutant::Either Private

Inherits:
Object
  • Object
show all
Includes:
AbstractType, Adamantium::Flat, Functor
Defined in:
lib/mutant/base.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Maybe

Direct Known Subclasses

Left, Right

Defined Under Namespace

Classes: Left, Right

Class Method Summary collapse

Class Method Details

.wrap_error(error) ⇒ Either<Exception, Object>

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Execute block and wrap error in left

Parameters:

  • error (Class:Exception)

Returns:



82
83
84
85
86
# File 'lib/mutant/base.rb', line 82

def self.wrap_error(error)
  Right.new(yield)
rescue error => exception
  Left.new(exception)
end