Sha256: 9eab2124a7a4b1b7bd7d5b63595082a3e38d055f84b0fa9a985a6390148a9dc7
Contents?: true
Size: 960 Bytes
Versions: 10
Compression:
Stored size: 960 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 self.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
10 entries across 10 versions & 1 rubygems