Class: ActiveFedora::Associations::RecordComposite::Repository

Inherits:
Object
  • Object
show all
Defined in:
lib/active_fedora/associations/record_composite.rb

Overview

A Repository which returns a composite from #find instead of a single record. Delegates find to a base repository.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(base_repository:) ⇒ Repository

Returns a new instance of Repository.



27
28
29
# File 'lib/active_fedora/associations/record_composite.rb', line 27

def initialize(base_repository:)
  @base_repository = base_repository
end

Instance Attribute Details

#base_repositoryObject (readonly)

Returns the value of attribute base_repository.



25
26
27
# File 'lib/active_fedora/associations/record_composite.rb', line 25

def base_repository
  @base_repository
end

Instance Method Details

#find(ids) ⇒ Object



31
32
33
34
35
36
# File 'lib/active_fedora/associations/record_composite.rb', line 31

def find(ids)
  records = ids.map do |id|
    base_repository.find(id)
  end
  RecordComposite.new(records: records)
end