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.
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_repository ⇒ Object (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 |