Sha256: 0e6088da3fe39a67985fc66d6a63817a9c1e0667de5da6f795b1b9d858f835c2
Contents?: true
Size: 956 Bytes
Versions: 4
Compression:
Stored size: 956 Bytes
Contents
module ActiveFedora::Associations ## # A Composite for records - currently only supports delete interface. # The goal is to push commands down to the containing records. class RecordComposite attr_reader :records include Enumerable def initialize(records:) @records = records end def each records.each do |record| yield record end end def delete each(&:delete) end ## # A Repository which returns a composite from #find instead of a single # record. Delegates find to a base repository. class Repository attr_reader :base_repository delegate :translate_uri_to_id, to: :base_repository def initialize(base_repository:) @base_repository = base_repository end def find(ids) records = ids.map do |id| base_repository.find(id) end RecordComposite.new(records: records) end end end end
Version data entries
4 entries across 4 versions & 1 rubygems