Sha256: ce09fb232ec5e6557022ec8179a806f9be083f449494b90493b0291768ae8118

Contents?: true

Size: 1.51 KB

Versions: 5

Compression:

Stored size: 1.51 KB

Contents

# frozen_string_literal: true

module Thinreports
  module BasicReport
    module Generator
      class PDF
        module Drawer
          class ListSection < Page
            # @param pdf (see PDF::Drawer::Page#initialize)
            # @param section [Thinreports::BasicReport::Core::Shape::List::SectionInternal] section
            def initialize(pdf, section)
              super(pdf, section.format)
              @section = section
              @stamp_created = false
            end

            # @param [Thinreports::BasicReport::Core::Shape::List::SectionInternal] section
            # @param [Array<Numeric>] at
            def draw(section, at)
              @draw_at = at
              draw_section
              super(section)
            end

            private

            def draw_section
              id = @format.identifier.to_s

              unless @stamp_created
                @pdf.create_stamp(id) { @pdf.draw_template_items(@format.attributes['items']) }
                @stamp_created = true
              end
              pdf_stamp(id)
            end

            # @see Thinreports::BasicReport::Generator::PDF::Drawer::Page#draw_tblock_shape
            def draw_tblock_shape(shape)
              @pdf.translate(*@draw_at) { super }
            end

            # @see Thinreports::BasicReport::Generator::PDF::Drawer::Page#draw_iblock_shape
            def draw_iblock_shape(shape)
              @pdf.translate(*@draw_at) { super }
            end
          end
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
thinreports-0.14.2 lib/thinreports/basic_report/generator/pdf/drawer/list_section.rb
thinreports-0.14.1 lib/thinreports/basic_report/generator/pdf/drawer/list_section.rb
thinreports-0.14.0 lib/thinreports/basic_report/generator/pdf/drawer/list_section.rb
thinreports-0.13.1 lib/thinreports/basic_report/generator/pdf/drawer/list_section.rb
thinreports-0.13.0 lib/thinreports/basic_report/generator/pdf/drawer/list_section.rb