Sha256: 81c7f27cd354f77b2df83ab536367b663fe78cf5bcd924ae7f10b3cc071fec22

Contents?: true

Size: 506 Bytes

Versions: 6

Compression:

Stored size: 506 Bytes

Contents

class Prawn::SVG::Elements::Polygon < Prawn::SVG::Elements::Base
  include Prawn::SVG::Pathable

  def parse
    require_attributes('points')
    @points = parse_points(attributes['points'])
  end

  def apply
    apply_commands
    apply_markers
  end

  protected

  def commands
    @commands ||= [
      Prawn::SVG::Pathable::Move.new(@points[0])
    ] + @points[1..].map { |point|
      Prawn::SVG::Pathable::Line.new(point)
    } + [
      Prawn::SVG::Pathable::Close.new(@points[0])
    ]
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
prawn-svg-0.37.0 lib/prawn/svg/elements/polygon.rb
prawn-svg-0.36.2 lib/prawn/svg/elements/polygon.rb
prawn-svg-0.36.1 lib/prawn/svg/elements/polygon.rb
prawn-svg-0.36.0 lib/prawn/svg/elements/polygon.rb
prawn-svg-0.35.1 lib/prawn/svg/elements/polygon.rb
prawn-svg-0.35.0 lib/prawn/svg/elements/polygon.rb