class ChunkyPNG::Vector
def self.multiple_from_array(source)
def self.multiple_from_array(source) return [] if source.empty? if source.first.kind_of?(Numeric) || source.first =~ /^\d+$/ raise ChunkyPNG::ExpectationFailed, "The points array is expected to have an even number of items!" if source.length % 2 != 0 points = [] source.each_slice(2) { |x, y| points << ChunkyPNG::Point.new(x, y) } return points else source.map { |p| ChunkyPNG::Point(p) } end end