class Hanikamu::Service
:nodoc
Constants
- Error
Public Class Methods
call(options = {})
click to toggle source
# File lib/hanikamu/service.rb, line 13 def call(options = {}) options.empty? ? new.call : new(options)&.call rescue Dry::Struct::Error => e self::Failure.new(e) end
call!(options = {})
click to toggle source
# File lib/hanikamu/service.rb, line 19 def call!(options = {}) options.empty? ? new.call! : new(options).call! end
Public Instance Methods
call()
click to toggle source
`call` should not be implemented in subclasses
# File lib/hanikamu/service.rb, line 25 def call Success(call!) rescue => e return Failure(e) if whitelisted_error?(e.class) raise end
whitelisted_error?(error_klass)
click to toggle source
# File lib/hanikamu/service.rb, line 33 def whitelisted_error?(error_klass) error_klass == Hanikamu::Service::Error || error_klass.superclass == Hanikamu::Service::Error end