Class: Rspikes::Spike

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

Instance Method Summary collapse

Instance Method Details

#spike(data, rows = 1) ⇒ Object



6
7
8
9
10
11
12
13
14
15
# File 'lib/rspikes.rb', line 6

def spike(data, rows = 1)
  normalized_data = normalize(data, rows)
  spiked_data = spike_data(normalized_data, rows)
  spikes = ''
  spiked_data.reverse.each_with_index do |spiked_row, index|
    spikes += print_spike(spiked_row)
    spikes += "\n" unless index + 1 >= spiked_data.length
  end
  spikes
end