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