Class: Buncher::Cluster

Inherits:
Object
  • Object
show all
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

Instance Method Summary collapse

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

#centerObject

Returns the value of attribute center.



7
8
9
# File 'lib/buncher.rb', line 7

def center
  @center
end

#elementsObject

Returns the value of attribute elements.



6
7
8
# File 'lib/buncher.rb', line 6

def elements
  @elements
end

Instance Method Details

#clearObject



13
14
15
# File 'lib/buncher.rb', line 13

def clear
  elements.clear
end

#sizeObject



17
18
19
# File 'lib/buncher.rb', line 17

def size
  elements.size
end