Class: PrawnStyledText::HighlightCallback
- Inherits:
-
Object
- Object
- PrawnStyledText::HighlightCallback
- Defined in:
- lib/prawn-styled-text/callbacks.rb
Instance Method Summary collapse
-
#initialize(pdf) ⇒ HighlightCallback
constructor
A new instance of HighlightCallback.
- #render_behind(fragment) ⇒ Object
-
#set_color(color) ⇒ Object
rubocop:disable Naming/AccessorMethodName.
Constructor Details
#initialize(pdf) ⇒ HighlightCallback
Returns a new instance of HighlightCallback.
5 6 7 |
# File 'lib/prawn-styled-text/callbacks.rb', line 5 def initialize(pdf) @document = pdf end |
Instance Method Details
#render_behind(fragment) ⇒ Object
13 14 15 16 17 18 |
# File 'lib/prawn-styled-text/callbacks.rb', line 13 def render_behind(fragment) original_color = @document.fill_color @document.fill_color = @color @document.fill_rectangle(fragment.top_left, fragment.width, fragment.height) @document.fill_color = original_color end |
#set_color(color) ⇒ Object
rubocop:disable Naming/AccessorMethodName
9 10 11 |
# File 'lib/prawn-styled-text/callbacks.rb', line 9 def set_color(color) # rubocop:disable Naming/AccessorMethodName @color = color || DEF_BG_MARK end |