Class: Hyrax::CustomQueries::FindCollectionsByType
- Inherits:
-
Object
- Object
- Hyrax::CustomQueries::FindCollectionsByType
- Defined in:
- app/services/hyrax/custom_queries/find_collections_by_type.rb
Overview
Instance Attribute Summary collapse
-
#query_service ⇒ Object
readonly
Returns the value of attribute query_service.
Class Method Summary collapse
Instance Method Summary collapse
- #find_collections_by_type(global_id:) ⇒ Enumerable<PcdmCollection>
-
#initialize(query_service:) ⇒ FindCollectionsByType
constructor
A new instance of FindCollectionsByType.
Constructor Details
#initialize(query_service:) ⇒ FindCollectionsByType
Returns a new instance of FindCollectionsByType.
15 16 17 |
# File 'app/services/hyrax/custom_queries/find_collections_by_type.rb', line 15 def initialize(query_service:) @query_service = query_service end |
Instance Attribute Details
#query_service ⇒ Object (readonly)
Returns the value of attribute query_service.
19 20 21 |
# File 'app/services/hyrax/custom_queries/find_collections_by_type.rb', line 19 def query_service @query_service end |
Class Method Details
.queries ⇒ Object
11 12 13 |
# File 'app/services/hyrax/custom_queries/find_collections_by_type.rb', line 11 def self.queries [:find_collections_by_type] end |
Instance Method Details
#find_collections_by_type(global_id:) ⇒ Enumerable<PcdmCollection>
Note:
this is an unoptimized default implementation of this custom query. it’s Hyrax’s policy to provide such implementations of custom queries in use for cross-compatibility of Valkyrie query services. it’s advisable to provide an optimized query for the specific adapter.
31 32 33 34 35 |
# File 'app/services/hyrax/custom_queries/find_collections_by_type.rb', line 31 def find_collections_by_type(global_id:) query_service .find_all_of_model(model: Hyrax.config.collection_model.safe_constantize) .select { |collection| collection.collection_type_gid == global_id } end |