Module: ToProcInterface::CallToMaybe Abstract

Includes:
Mixin
Defined in:
lib/to_proc_interface.rb

Overview

This module is abstract.

The instance method ‘#call` should return a monad-like object responsible to `#to_maybe`.

Interface with predefined #call method which delegates all the given params into class’ constructor and invokes instance’s #call method converting a result monad into maybe.

Examples:

Usage

extend ToProcInterface::CallToMaybe

Instance Method Summary collapse

Methods included from Mixin

#to_proc

Methods included from Delegations

#:<<, #:>>, #:[], #arity, #binding, #curry, delegate_to_proc, #lambda?, #parameters, proc_methods, #ruby2_keywords, #source_location, #yield

Instance Method Details

#call(*args, **opts, &block) ⇒ Dry::Monads::Maybe

Returns:

  • (Dry::Monads::Maybe)

See Also:



151
152
153
154
155
# File 'lib/to_proc_interface.rb', line 151

def call(*args, **opts, &block)
  instance = new(*args, **opts, &block)
  result = instance.call
  result.to_maybe
end