Sha256: 2828783a0e96d3c8543e6352813efbe41f837682493f7b85573225a40a2b12f4
Contents?: true
Size: 375 Bytes
Versions: 1
Compression:
Stored size: 375 Bytes
Contents
# frozen_string_literal: true module Patterns class Service attr_reader :result, :error def self.call(**args) new(**args).tap { |s| catch(:service_error) { s.call } } end def fail!(error = :error) @error = error throw :service_error end def success? error.nil? end def failure? !success? end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
2n-patterns-0.0.0 | lib/patterns/service.rb |