lib/prawn/graphics/cap_style.rb in prawn-0.11.1.pre vs lib/prawn/graphics/cap_style.rb in prawn-0.11.1
- old
+ new
@@ -9,30 +9,38 @@
module Prawn
module Graphics
module CapStyle
CAP_STYLES = { :butt => 0, :round => 1, :projecting_square => 2 }
-
+
# Sets the cap style for stroked lines and curves
#
# style is one of :butt, :round, or :projecting_square
#
# NOTE: If this method is never called, :butt will be used by default.
#
def cap_style(style=nil)
- return @cap_style || :butt if style.nil?
+ return current_cap_style || :butt if style.nil?
- @cap_style = style
+ self.current_cap_style = style
write_stroke_cap_style
end
-
+
alias_method :cap_style=, :cap_style
private
+ def current_cap_style
+ graphic_state.cap_style
+ end
+
+ def current_cap_style=(style)
+ graphic_state.cap_style = style
+ end
+
def write_stroke_cap_style
- add_content "#{CAP_STYLES[@cap_style]} J"
+ add_content "#{CAP_STYLES[current_cap_style]} J"
end
end
end
end