Sha256: 9ff023c0e529fa9b3fccab7bc79d88d3e6e4eed8cb35ff51e1c65f89bd09d50d

Contents?: true

Size: 882 Bytes

Versions: 7

Compression:

Stored size: 882 Bytes

Contents

# frozen_string_literal: true

require_relative 'stack_view_renderer'
require_relative 'section_height'
require_relative 'draw_item'

module Thinreports
  module SectionReport
    module Renderer
      class SectionRenderer
        include SectionHeight
        include DrawItem

        def initialize(pdf)
          @pdf = pdf
        end

        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

        private

        attr_reader :pdf

        def stack_view_renderer
          @stack_view_renderer ||= Renderer::StackViewRenderer.new(pdf)
        end
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
thinreports-0.14.2 lib/thinreports/section_report/pdf/renderer/section_renderer.rb
thinreports-0.14.1 lib/thinreports/section_report/pdf/renderer/section_renderer.rb
thinreports-0.14.0 lib/thinreports/section_report/pdf/renderer/section_renderer.rb
thinreports-0.13.1 lib/thinreports/section_report/pdf/renderer/section_renderer.rb
thinreports-0.13.0 lib/thinreports/section_report/pdf/renderer/section_renderer.rb
thinreports-0.12.1 lib/thinreports/section_report/pdf/renderer/section_renderer.rb
thinreports-0.12.0 lib/thinreports/section_report/pdf/renderer/section_renderer.rb