Class: Wakame::Models::ServiceClusterPool

Inherits:
Sequel::Model
  • Object
show all
Defined in:
lib/wakame/models/service_cluster_pool.rb

Class Method Summary collapse

Class Method Details

.each_cluster(&blk) ⇒ Object



26
27
28
29
30
31
# File 'lib/wakame/models/service_cluster_pool.rb', line 26

def self.each_cluster(&blk)
  self.all.each { |m|
    cluster = Service::ServiceCluster.find(m.service_cluster_id)
    blk.call(cluster)
  }
end

.register_cluster(name) ⇒ Object



15
16
17
18
19
# File 'lib/wakame/models/service_cluster_pool.rb', line 15

def self.register_cluster(name)
  id = Service::ServiceCluster.id(name)
  
  self.find_or_create(:service_cluster_id=>id)
end

.unregister_cluster(name) ⇒ Object



21
22
23
24
# File 'lib/wakame/models/service_cluster_pool.rb', line 21

def self.unregister_cluster(name)
  id = Service::ServiceCluster.id(name)
  self.delete(:service_cluster_id=>id)
end