Class: Thinreports::SectionReport::Renderer::SectionRenderer
- Inherits:
-
Object
- Object
- Thinreports::SectionReport::Renderer::SectionRenderer
- Includes:
- DrawItem, SectionHeight
- Defined in:
- lib/thinreports/section_report/pdf/renderer/section_renderer.rb
Instance Method Summary collapse
-
#initialize(pdf) ⇒ SectionRenderer
constructor
A new instance of SectionRenderer.
- #render(section) ⇒ Object
Methods included from DrawItem
Methods included from SectionHeight
#calc_float_content_bottom, #calc_text_block_height, #image_block_layout, #item_layout, #section_height, #stack_view_layout, #static_layout, #text_layout
Constructor Details
#initialize(pdf) ⇒ SectionRenderer
Returns a new instance of SectionRenderer.
14 15 16 |
# File 'lib/thinreports/section_report/pdf/renderer/section_renderer.rb', line 14 def initialize(pdf) @pdf = pdf end |
Instance Method Details
#render(section) ⇒ Object
18 19 20 21 22 23 24 25 26 27 |
# File 'lib/thinreports/section_report/pdf/renderer/section_renderer.rb', line 18 def render(section) doc = pdf.pdf actual_height = section_height(section) doc.bounding_box([0, doc.cursor], width: doc.bounds.width, height: actual_height) do section.items.each do |item| draw_item(item, (actual_height - section.schema.height)) end end end |