Class: DbClustering::Models::Cluster

Inherits:
Object
  • Object
show all
Defined in:
lib/models/cluster.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeCluster

Returns a new instance of Cluster.



7
8
9
10
# File 'lib/models/cluster.rb', line 7

def initialize
  @points = []
  @id = SecureRandom.urlsafe_base64(3, false)
end

Instance Attribute Details

#idObject

Returns the value of attribute id.



5
6
7
# File 'lib/models/cluster.rb', line 5

def id
  @id
end

#pointsObject

Returns the value of attribute points.



5
6
7
# File 'lib/models/cluster.rb', line 5

def points
  @points
end

Instance Method Details

#add(point) ⇒ Object



12
13
14
15
# File 'lib/models/cluster.rb', line 12

def add(point)
  @points << point
  point.cluster = self
end