class MPrelude::Either
Public Class Methods
wrap_error(*exceptions) { || ... }
click to toggle source
Execute block and wrap error in left
@param [Class<Exception>] exception
@return [Either<Exception, Object>]
# File lib/mprelude.rb, line 84 def self.wrap_error(*exceptions) Right.new(yield) rescue *exceptions => error Left.new(error) end
Public Instance Methods
left?()
click to toggle source
Test for left constructor
@return [Boolean]
# File lib/mprelude.rb, line 93 def left? instance_of?(Left) end
right?()
click to toggle source
Test for right constructor
@return [Boolean]
# File lib/mprelude.rb, line 100 def right? instance_of?(Right) end