Class: ActiveFedora::Associations::RecordComposite::Repository
- Inherits:
-
Object
- Object
- ActiveFedora::Associations::RecordComposite::Repository
- 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
-
#base_repository ⇒ Object
readonly
Returns the value of attribute base_repository.
Instance Method Summary collapse
- #find(ids) ⇒ Object
-
#initialize(base_repository:) ⇒ Repository
constructor
A new instance of Repository.
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_repository ⇒ Object (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 |