Sha256: 136537e74a7d194b70a7395eb6f5f9d308575a195716538274fdaf797218d8b7
Contents?: true
Size: 1.52 KB
Versions: 2
Compression:
Stored size: 1.52 KB
Contents
# frozen_string_literal: true require 'repository/support/store_result' require_relative 'slug_finder' module Repository # Base class for Repository in Data Mapper pattern. class Base # Internal support code exclusively used by Repository::Base module Internals # Stows away details of reporting update success/failure. # @since 0.0.5 class RecordDeleter include Repository::Support # Initializes a new instance of `SlugFinder`. # @param identifier [String] [Slug](http://en.wikipedia.org/wiki/Semantic_URL#Slug) # for record to be deleted. # @param dao Data Access Object implements persistence without business # logic. # @param factory Factory-pattern class to build an entity from an # existing DAO record. def initialize(identifier:, dao:, factory:) @identifier = identifier @dao = dao @factory = factory end # Command-pattern method returning indication of success or failure of # attempt to delete identified record. # @return Repository::Support::StoreResult def delete finder = SlugFinder.new slug: identifier, dao: dao, factory: factory result = finder.find return result unless result.success dao.delete identifier result end private attr_reader :dao, :factory, :identifier end # class Repository::Base::Internals::RecordDeleter end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
repository-base-0.4.1 | lib/repository/base/internals/record_deleter.rb |
repository-base-0.4.0 | lib/repository/base/internals/record_deleter.rb |