Class: Hyrax::CustomQueries::Navigators::ChildFileSetsNavigator
- Inherits:
-
Object
- Object
- Hyrax::CustomQueries::Navigators::ChildFileSetsNavigator
- Defined in:
- app/services/hyrax/custom_queries/navigators/child_file_sets_navigator.rb
Overview
Navigate from a resource to the child filesets in the resource.
Instance Attribute Summary collapse
- #query_service ⇒ Object readonly
Class Method Summary collapse
-
.queries ⇒ Object
Define the queries that can be fulfilled by this navigator.
Instance Method Summary collapse
-
#find_child_file_set_ids(resource:) ⇒ Array<Valkyrie::ID>
Find the ids of child filesets of a given resource, and map to Valkyrie Resources IDs.
-
#find_child_file_sets(resource:) ⇒ Array<Valkyrie::Resource>
Find child filesets of a given resource, and map to Valkyrie Resources.
-
#initialize(query_service:) ⇒ ChildFileSetsNavigator
constructor
A new instance of ChildFileSetsNavigator.
Constructor Details
#initialize(query_service:) ⇒ ChildFileSetsNavigator
Returns a new instance of ChildFileSetsNavigator.
19 20 21 |
# File 'app/services/hyrax/custom_queries/navigators/child_file_sets_navigator.rb', line 19 def initialize(query_service:) @query_service = query_service end |
Instance Attribute Details
#query_service ⇒ Object (readonly)
17 18 19 |
# File 'app/services/hyrax/custom_queries/navigators/child_file_sets_navigator.rb', line 17 def query_service @query_service end |
Class Method Details
.queries ⇒ Object
Define the queries that can be fulfilled by this navigator.
13 14 15 |
# File 'app/services/hyrax/custom_queries/navigators/child_file_sets_navigator.rb', line 13 def self.queries [:find_child_file_sets, :find_child_file_set_ids] end |
Instance Method Details
#find_child_file_set_ids(resource:) ⇒ Array<Valkyrie::ID>
Find the ids of child filesets of a given resource, and map to Valkyrie Resources IDs
39 40 41 |
# File 'app/services/hyrax/custom_queries/navigators/child_file_sets_navigator.rb', line 39 def find_child_file_set_ids(resource:) find_child_file_sets(resource: resource).map(&:id) end |
#find_child_file_sets(resource:) ⇒ Array<Valkyrie::Resource>
Find child filesets of a given resource, and map to Valkyrie Resources
29 30 31 |
# File 'app/services/hyrax/custom_queries/navigators/child_file_sets_navigator.rb', line 29 def find_child_file_sets(resource:) query_service.find_members(resource: resource).select(&:file_set?) end |