class Qo::Branches::MonadicWhenBranch

Based on the `where` branch, except deals with monadic values by attempting to extract the `value` before yielding to the given function on a match:

“`ruby Matcher.new.call(Some) { |m|

m.where(Some) { |v| v + 2 }

} # => 3 “`

@author baweaver @since 1.0.0

Public Class Methods

new(destructure: false, extractor: :value) click to toggle source
Calls superclass method Qo::Branches::Branch::new
# File lib/qo/branches/monadic_when_branch.rb, line 16
def initialize(destructure: false, extractor: :value)
  super(
    name: 'where',
    destructure: destructure,
    extractor: extractor,
    default: false,
  )
end