Class: Clusters::BuildService

Inherits:
Object
  • Object
show all
Defined in:
app/services/clusters/build_service.rb

Instance Method Summary collapse

Constructor Details

#initialize(subject) ⇒ BuildService

Returns a new instance of BuildService.


4
5
6
# File 'app/services/clusters/build_service.rb', line 4

def initialize(subject)
  @subject = subject
end

Instance Method Details

#executeObject


8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'app/services/clusters/build_service.rb', line 8

def execute
  ::Clusters::Cluster.new.tap do |cluster|
    case @subject
    when ::Project
      cluster.cluster_type = :project_type
    when ::Group
      cluster.cluster_type = :group_type
    when Instance
      cluster.cluster_type = :instance_type
    else
      raise NotImplementedError
    end
  end
end