Class: SnippetsFinder

Inherits:
Object
  • Object
show all
Defined in:
app/finders/snippets_finder.rb

Instance Method Summary collapse

Instance Method Details

#execute(current_user, params = {}) ⇒ Object


2
3
4
5
6
7
8
9
10
11
12
13
# File 'app/finders/snippets_finder.rb', line 2

def execute(current_user, params = {})
  filter = params[:filter]

  case filter
  when :all then
    snippets(current_user).fresh
  when :by_user then
    by_user(current_user, params[:user], params[:scope])
  when :by_project
    by_project(current_user, params[:project])
  end
end