Sha256: e3fcc22b04f611cf37edfeacb574f3f69e681f5ea1a4719cf4c69b407c2a5a6d
Contents?: true
Size: 1006 Bytes
Versions: 2
Compression:
Stored size: 1006 Bytes
Contents
# frozen_string_literal: true module Repository module Support # Uniform representation of success or failure of a storage-command action. class StoreResult # Convenience class to instantiate a "successful" StoreResult. class Success < StoreResult def initialize(entity) super entity: entity, errors: [], success: true end end # class Repository::Support::StoreResult::Success # Convenience class to instantiate a "failed" StoreResult. class Failure < StoreResult def initialize(errors) super entity: nil, errors: errors, success: false end end # class Repository::Support::StoreResult::Failure attr_reader :entity, :errors, :success alias_method :success?, :success # rubocop:disable Style/Alias def initialize(entity:, errors:, success:) @entity = entity @errors = errors @success = success end end # class Repository::Support::StoreResult end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
repository-support-0.1.3 | lib/repository/support/store_result.rb |
repository-support-0.1.1 | lib/repository/support/store_result.rb |