class ChunkyPNG::Vector

def each_edge(close = true)

Other tags:
    See: #edges -

Raises:
  • (ChunkyPNG::ExpectationFailed) - if the vector contains less than two points.

Returns:
  • (void) -

Parameters:
  • close (true, false) -- Whether to close the path, i.e. return an edge that connects the last
def each_edge(close = true)
  raise ChunkyPNG::ExpectationFailed, "Not enough points in this path to draw an edge!" if length < 2
  points.each_cons(2) { |a, b| yield(a, b) }
  yield(points.last, points.first) if close
end