Sha256: 30e65f2c8f1b5b7318acef3f6f8293afb19075839e2ddbbd4050b1b794f14da7
Contents?: true
Size: 514 Bytes
Versions: 3
Compression:
Stored size: 514 Bytes
Contents
class Prawn::SVG::Elements::Polyline < Prawn::SVG::Elements::Base def parse require_attributes('points') @points = parse_points(attributes['points']) end def apply raise SkipElementQuietly unless @points.length > 0 add_call 'move_to', *@points[0] add_call_and_enter 'stroke' @points[1..-1].each do |x, y| add_call "line_to", x, y end end def bounding_box x1, x2 = @points.map(&:first).minmax y2, y1 = @points.map(&:last).minmax [x1, y1, x2, y2] end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
prawn-svg-0.23.1 | lib/prawn/svg/elements/polyline.rb |
prawn-svg-0.23.0 | lib/prawn/svg/elements/polyline.rb |
prawn-svg-0.22.1 | lib/prawn/svg/elements/polyline.rb |