Sha256: dec7814ce680243bc0baee6dfad60cafb2839bc82e74422b578c1a0457da0d12

Contents?: true

Size: 350 Bytes

Versions: 3

Compression:

Stored size: 350 Bytes

Contents

class Prawn::SVG::Elements::Polygon < Prawn::SVG::Elements::Base
  def parse
    require_attributes('points')
    @points = parse_points(attributes['points'])
  end

  def apply
    add_call 'polygon', *@points
  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/polygon.rb
prawn-svg-0.23.0 lib/prawn/svg/elements/polygon.rb
prawn-svg-0.22.1 lib/prawn/svg/elements/polygon.rb