Class: ClusterAncestorsFinder

Inherits:
Object
  • Object
show all
Includes:
Gitlab::Utils::StrongMemoize
Defined in:
app/finders/cluster_ancestors_finder.rb

Instance Method Summary collapse

Constructor Details

#initialize(clusterable, current_user) ⇒ ClusterAncestorsFinder

Returns a new instance of ClusterAncestorsFinder.



6
7
8
9
# File 'app/finders/cluster_ancestors_finder.rb', line 6

def initialize(clusterable, current_user)
  @clusterable = clusterable
  @current_user = current_user
end

Instance Method Details

#executeObject



11
12
13
14
15
# File 'app/finders/cluster_ancestors_finder.rb', line 11

def execute
  return [] unless can_read_clusters?

  clusterable.clusters + ancestor_clusters
end

#has_ancestor_clusters?Boolean

Returns:

  • (Boolean)


17
18
19
# File 'app/finders/cluster_ancestors_finder.rb', line 17

def has_ancestor_clusters?
  ancestor_clusters.any?
end