Module: Fourmi::Prawn::Utils::Extensions::StrokesAndColors

Defined in:
lib/fourmi/prawn/utils/extensions/strokes_and_colors.rb

Instance Method Summary collapse

Instance Method Details

#with_fill_color(color) ⇒ Object



4
5
6
7
8
9
10
11
# File 'lib/fourmi/prawn/utils/extensions/strokes_and_colors.rb', line 4

def with_fill_color(color)
  original_color = fill_color
  self.fill_color = color

  yield if block_given?
ensure
  self.fill_color = original_color
end

#with_stroke_properties(color: nil, width: nil) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/fourmi/prawn/utils/extensions/strokes_and_colors.rb', line 13

def with_stroke_properties(color: nil, width: nil)
  original_color = stroke_color
  original_width = line_width

  self.stroke_color = color unless color.nil?
  self.line_width = width unless width.nil?

  yield if block_given?
ensure
  self.stroke_color = original_color
  self.line_width = original_width
end