Class: Wings::CustomQueries::FindCollectionsByType

Inherits:
Object
  • Object
show all
Defined in:
lib/wings/services/custom_queries/find_collections_by_type.rb

Overview

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(query_service:) ⇒ FindCollectionsByType

Returns a new instance of FindCollectionsByType.


11
12
13
# File 'lib/wings/services/custom_queries/find_collections_by_type.rb', line 11

def initialize(query_service:)
  @query_service = query_service
end

Instance Attribute Details

#query_serviceObject (readonly)

Returns the value of attribute query_service


15
16
17
# File 'lib/wings/services/custom_queries/find_collections_by_type.rb', line 15

def query_service
  @query_service
end

Class Method Details

.queriesObject


7
8
9
# File 'lib/wings/services/custom_queries/find_collections_by_type.rb', line 7

def self.queries
  [:find_collections_by_type]
end

Instance Method Details

#find_collections_by_type(global_id:) ⇒ Enumerable<PcdmCollection>

Parameters:

  • global_id (GlobalID)

    global id for a Hyrax::CollectionType

Returns:

  • (Enumerable<PcdmCollection>)

22
23
24
# File 'lib/wings/services/custom_queries/find_collections_by_type.rb', line 22

def find_collections_by_type(global_id:)
  ::Collection.where(Hyrax.config.collection_type_index_field.to_sym => global_id.to_s).map(&:valkyrie_resource)
end