Class: Snippets::CountService
- Inherits:
-
Object
- Object
- Snippets::CountService
- Defined in:
- app/services/snippets/count_service.rb
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(current_user, author: nil, project: nil) ⇒ CountService
constructor
A new instance of CountService.
Constructor Details
#initialize(current_user, author: nil, project: nil) ⇒ CountService
Returns a new instance of CountService.
37 38 39 40 41 42 43 44 45 |
# File 'app/services/snippets/count_service.rb', line 37 def initialize(current_user, author: nil, project: nil) if ! && !project raise( ArgumentError, 'Must provide either an author or a project' ) end @snippets_finder = SnippetsFinder.new(current_user, author: , project: project) end |
Instance Method Details
#execute ⇒ Object
47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'app/services/snippets/count_service.rb', line 47 def execute counts = snippet_counts return {} unless counts counts.slice( :are_public, :are_private, :are_internal, :are_public_or_internal, :total ) end |