Class: ActiveFedora::Associations::ContainedFinder

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

Overview

Finds the objects which associate with a given record and are contained within the given container. Uses #repository to find the objects.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(container:, repository:, proxy_class:) ⇒ ContainedFinder

Returns a new instance of ContainedFinder.

Parameters:

  • container (#contained_ids)

    a container that records are stored under.

  • repository (#translate_uri_to_id, #find)

    a repository to build objects from.

  • proxy_class (ActiveFedora::Base)

    class that represents an ore:Proxy



14
15
16
17
18
# File 'lib/active_fedora/associations/contained_finder.rb', line 14

def initialize(container:, repository:, proxy_class:)
  @container = container
  @repository = repository
  @proxy_class = proxy_class
end

Instance Attribute Details

#containerObject (readonly)

Returns the value of attribute container.



6
7
8
# File 'lib/active_fedora/associations/contained_finder.rb', line 6

def container
  @container
end

#proxy_classObject (readonly)

Returns the value of attribute proxy_class.



6
7
8
# File 'lib/active_fedora/associations/contained_finder.rb', line 6

def proxy_class
  @proxy_class
end

#repositoryObject (readonly)

Returns the value of attribute repository.



6
7
8
# File 'lib/active_fedora/associations/contained_finder.rb', line 6

def repository
  @repository
end

Instance Method Details

#find(record) ⇒ Array<ActiveFedora::Base>

Returns This returns whatever type repository.find returns.

Parameters:

Returns:



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

def find(record)
  record.reload
  repository.find(matching_ids(record))
end