Class: DbClustering::Models::Cluster
- Inherits:
-
Object
- Object
- DbClustering::Models::Cluster
- Defined in:
- lib/models/cluster.rb
Instance Attribute Summary collapse
-
#id ⇒ Object
Returns the value of attribute id.
-
#points ⇒ Object
Returns the value of attribute points.
Instance Method Summary collapse
- #add(point) ⇒ Object
-
#initialize ⇒ Cluster
constructor
A new instance of Cluster.
Constructor Details
#initialize ⇒ Cluster
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
#id ⇒ Object
Returns the value of attribute id.
5 6 7 |
# File 'lib/models/cluster.rb', line 5 def id @id end |
#points ⇒ Object
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 |