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.



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

def initialize(base_repository:)
  @base_repository = base_repository
end

Instance Attribute Details

#base_repositoryObject (readonly)

Returns the value of attribute base_repository.



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

def base_repository
  @base_repository
end

Instance Method Details

#find(ids) ⇒ Object



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

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