Class enhancement

You can offer a match block API from your own methods using Dry::Matcher.for:

require "dry-matcher"

# First, build a matcher or use an existing one (like dry-matcher's EitherMatcher)
MyMatcher =

# Offer it from your class with `Dry::Matcher.for`
class MyOperation
  include Dry::Matcher.for(:call, with: MyMatcher)

  def call
    # return a value here

# And now `MyOperation#call` offers the matcher block API
operation =

operation.() do |m|
  # Use the matcher's API here