Method: Valkyrie::Persistence::Memory::QueryService#count_all_of_model

Defined in:
lib/valkyrie/persistence/memory/query_service.rb

#count_all_of_model(model:) ⇒ Object

Count all objects of a given model.

Parameters:

  • model (Class)

    Class to query for.

Returns:

  • integer. Count objects in the persistence backend with the given class.



80
81
82
# File 'lib/valkyrie/persistence/memory/query_service.rb', line 80

def count_all_of_model(model:)
  cache.values.count { |obj| obj.is_a?(model) }
end