Module: Operto::Operation

Overview

#call! returns the same Result as #call, raising the failure instead of wrapping it — hence the alias call! call on every operation below.

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



5
6
7
# File 'lib/operto/operation.rb', line 5

def self.included(base)
  base.include Dry::Monads[:result]
end

Instance Method Details

#call!Object

Parameters:

  • (Object)
  • (Object)

Returns:

  • (Object)


9
10
11
12
13
14
# File 'lib/operto/operation.rb', line 9

def call!(...)
  result = call(...)
  raise result.failure if result.failure?

  result
end