Class: ClosestNeighbours::Indexer

Inherits:
Object
  • Object
show all
Defined in:
lib/closest_neighbours/indexer.rb

Overview

Determines the indexes where the data need to be grouped

Instance Method Summary collapse

Constructor Details

#initialize(groups = 1, data = []) ⇒ Indexer

Returns a new instance of Indexer.



6
7
8
9
# File 'lib/closest_neighbours/indexer.rb', line 6

def initialize(groups = 1, data = [])
  @groups = groups
  @data = data
end

Instance Method Details

#callObject



11
12
13
# File 'lib/closest_neighbours/indexer.rb', line 11

def call
  [0] + indexes + [data.count]
end