Utility class to describe a list of x, y coordinates. Each coordinate is an Array with 2 elements. The whole list is another Array.
Store the list after doing some error checking.
# File lib/taskjuggler/Painter/Points.rb, line 21 def initialize(arr) arr.each do |point| unless point.is_a?(Array) && point.length == 2 raise ArgumentError, 'Points must be an Array with 2 coordinates' end end @points = arr end
Conver the list of coordinates into a String that is compatible with SVG syntax.
# File lib/taskjuggler/Painter/Points.rb, line 32 def to_s str = '' @points.each do |point| str += "#{point[0]},#{point[1]} " end str end