class Unparser::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/unparser/either.rb, line 33 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/unparser/either.rb, line 42 def left? instance_of?(Left) end
right?()
click to toggle source
Test for right constructor
@return [Boolean]
# File lib/unparser/either.rb, line 49 def right? instance_of?(Right) end