summaryrefslogtreecommitdiff
path: root/app/finders/clusters_finder.rb
blob: 2b29c7bdf12690ab44ea9a70f66e2a62b4f15714 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
class ClustersFinder
  def initialize(project, user, scope)
    @project = project
    @user = user
    @scope = scope
  end

  def execute
    clusters = case @scope
               when :all
                 @project.clusters
               when :enabled
                 @project.clusters.enabled
               when :disabled
                 @project.clusters.disabled
               end
    clusters.map { |cluster| cluster.present(current_user: @user) }
  end
end