Class: Boxenn::UseCase

Inherits:
Object
  • Object
show all
Extended by:
Dry::Initializer
Includes:
Dry::Monads, Dry::Monads::Do, Wisper::Publisher
Defined in:
lib/boxenn/use_case.rb

Overview

這個類別是在 Domain(Use case) 層中負責處理業務邏輯的基礎類別

Instance Method Summary collapse

Instance Method Details

#call(*args) ⇒ Object



16
17
18
19
20
21
22
# File 'lib/boxenn/use_case.rb', line 16

def call(*args)
  Success(yield(steps(*args)))
rescue Dry::Monads::Do::Halt
  raise
rescue StandardError => e
  Failure.new([e], trace: e.backtrace.first)
end