Class: Buncher::Cluster
- Inherits:
-
Object
- Object
- Buncher::Cluster
- Defined in:
- lib/buncher.rb
Overview
your cluster needs to look like this. Make a bunch of them and pass them in. It’s ok to pass in empty elements to start.
Instance Attribute Summary collapse
-
#center ⇒ Object
Returns the value of attribute center.
-
#elements ⇒ Object
Returns the value of attribute elements.
Instance Method Summary collapse
- #clear ⇒ Object
-
#initialize(center, elements = []) ⇒ Cluster
constructor
A new instance of Cluster.
- #size ⇒ Object
Constructor Details
#initialize(center, elements = []) ⇒ Cluster
Returns a new instance of Cluster.
8 9 10 11 |
# File 'lib/buncher.rb', line 8 def initialize(center, elements=[]) self.center = center self.elements = elements end |
Instance Attribute Details
#center ⇒ Object
Returns the value of attribute center.
7 8 9 |
# File 'lib/buncher.rb', line 7 def center @center end |
#elements ⇒ Object
Returns the value of attribute elements.
6 7 8 |
# File 'lib/buncher.rb', line 6 def elements @elements end |
Instance Method Details
#clear ⇒ Object
13 14 15 |
# File 'lib/buncher.rb', line 13 def clear elements.clear end |
#size ⇒ Object
17 18 19 |
# File 'lib/buncher.rb', line 17 def size elements.size end |