Class: PrawnStyledText::StrikeThroughCallback

Inherits:
Object
  • Object
show all
Defined in:
lib/prawn-styled-text/callbacks.rb

Instance Method Summary collapse

Constructor Details

#initialize(pdf) ⇒ StrikeThroughCallback

Returns a new instance of StrikeThroughCallback.



22
23
24
# File 'lib/prawn-styled-text/callbacks.rb', line 22

def initialize(pdf)
  @document = pdf
end

Instance Method Details

#render_in_front(fragment) ⇒ Object



26
27
28
29
30
31
# File 'lib/prawn-styled-text/callbacks.rb', line 26

def render_in_front(fragment)
  y = (fragment.top_left[1] + fragment.bottom_left[1]) / 2
  @document.stroke do
    @document.line [fragment.top_left[0], y], [fragment.top_right[0], y]
  end
end