Class: Clusters::AgentsFinder

Inherits:
Object
  • Object
show all
Includes:
FinderMethods
Defined in:
app/finders/clusters/agents_finder.rb

Instance Method Summary collapse

Methods included from FinderMethods

#find, #find_by, #find_by!

Constructor Details

#initialize(object, current_user, params: {}) ⇒ AgentsFinder

Returns a new instance of AgentsFinder.


7
8
9
10
11
# File 'app/finders/clusters/agents_finder.rb', line 7

def initialize(object, current_user, params: {})
  @object = object
  @current_user = current_user
  @params = params
end

Instance Method Details

#executeObject


13
14
15
16
17
18
19
# File 'app/finders/clusters/agents_finder.rb', line 13

def execute
  return ::Clusters::Agent.none unless can_read_cluster_agents?

  agents = filter_clusters(object.cluster_agents)

  agents.ordered_by_name
end