Method: UnicodePlot::Canvas#lines!

Defined in:
lib/unicode_plot/canvas.rb

#lines!(x, y, color = :normal) ⇒ Object



149
150
151
152
153
154
155
156
157
158
159
# File 'lib/unicode_plot/canvas.rb', line 149

def lines!(x, y, color = :normal)
  if x.length != y.length
    raise ArgumentError, "x and y must be the same length"
  end
  unless x.length > 0
    raise ArgumentError, "x and y must not be empty"
  end
  (0 ... (x.length - 1)).each do |i|
    line!(x[i], y[i], x[i+1], y[i+1], color)
  end
end