Sha256: 5011d09b102757bb4af1d3f6020546d69fb0808a16ef5a9f048996eb63f73141
Contents?: true
Size: 732 Bytes
Versions: 2
Compression:
Stored size: 732 Bytes
Contents
# frozen_string_literal: true require 'clean_architecture/types' require 'dry/struct' module CleanArchitecture module Entities class FailureDetails < Dry::Struct FailureTypes = Types::Strict::String.enum( 'error', 'expectation_failed', 'not_found', 'unauthorized' ) attribute :type, FailureTypes attribute :message, Types::Strict::String attribute :other_properties, Types::Strict::Hash.default({}) def self.from_array(array) new(message: array.map(&:to_s).join(', '), other_properties: {}, type: 'error') end def self.from_string(string) new(message: string, other_properties: {}, type: 'error') end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
clean-architecture-2.0.0 | lib/clean_architecture/entities/failure_details.rb |
clean-architecture-1.2.0 | lib/clean_architecture/entities/failure_details.rb |