class EitherResultMatcher::Matcher
Attributes
output[R]
result[R]
Public Class Methods
new(result)
click to toggle source
# File lib/either_result_matcher/matcher.rb, line 8 def initialize(result) @result = result end
Public Instance Methods
failure(&block)
click to toggle source
# File lib/either_result_matcher/matcher.rb, line 17 def failure(&block) return output unless result.is_a?(Kleisli::Either::Left) @output = block.call(result.value) end
success(&block)
click to toggle source
# File lib/either_result_matcher/matcher.rb, line 12 def success(&block) return output unless result.is_a?(Kleisli::Either::Right) @output = block.call(result.value) end