# frozen_string_literal: true
# The cap style defines how the edge of a line or curve will be drawn. There are
# three types: :butt
(the default), :round
and
# :projecting_square
#
# The difference is better seen with thicker lines. With :butt
# lines are drawn starting and ending at the exact points provided. With both
# :round
and :projecting_square
the line is projected
# beyond the start and end points.
#
# Just like line_width=
the cap_style=
method needs an
# explicit receiver to work.
require_relative '../example_helper'
filename = File.basename(__FILE__).gsub('.rb', '.pdf')
Prawn::ManualBuilder::Example.generate(filename) do
stroke_axis
self.line_width = 25
%i[butt round projecting_square].each_with_index do |cap, i|
self.cap_style = cap
y = 250 - i * 100
stroke_horizontal_line 100, 300, at: y
stroke_circle [400, y], 15
end
end