Module: Sugpoko::Helpers::Prawn

Included in:
Component
Defined in:
lib/sugpoko/helpers/prawn.rb

Instance Method Summary collapse

Instance Method Details

#bounding_box(options = {}) ⇒ Object



4
5
6
7
8
9
# File 'lib/sugpoko/helpers/prawn.rb', line 4

def bounding_box(options = {})
  pos, options = build_bounding_box_options(options)
  pdf.bounding_box pos, options do
    yield
  end
end

#build_bounding_box_options(options) ⇒ Object



11
12
13
14
15
16
17
18
19
# File 'lib/sugpoko/helpers/prawn.rb', line 11

def build_bounding_box_options(options)
  pos = options.fetch(:position) { position }
  bounding_box_options = {
    width: width,
    height: height
  }
  bounding_box_options.merge! options
  return pos, bounding_box_options
end