class Qo::Branches::FailureBranch
A tuple branch that will be triggered when the first value is `:err`.
“`ruby ResultPatternMatch.new { |m|
m.failure { |v| "This is the error: #{v}" }
}.call([:err, 'OH NO!']) # => “This is the error: OH NO!” “`
@author baweaver @since 1.0.0
Public Class Methods
new(destructure: false)
click to toggle source
Calls superclass method
Qo::Branches::Branch::new
# File lib/qo/branches/failure_branch.rb, line 16 def initialize(destructure: false) super( name: 'failure', destructure: destructure, precondition: -> v { v.first == :err }, extractor: :last, ) end