Sha256: 147b7c144e12a770aa0e28a118fee80c737acc785562fa1a8541640d33374dcc

Contents?: true

Size: 1.35 KB

Versions: 7

Compression:

Stored size: 1.35 KB

Contents

# frozen_string_literal: true

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

          # @param [Thinreports::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::Generator::PDF::Drawer::Page#draw_tblock_shape
          def draw_tblock_shape(shape)
            @pdf.translate(*@draw_at) { super }
          end

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

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
thinreports-0.12.1 lib/thinreports/generator/pdf/drawer/list_section.rb
thinreports-0.12.0 lib/thinreports/generator/pdf/drawer/list_section.rb
thinreports-0.11.0 lib/thinreports/generator/pdf/drawer/list_section.rb
thinreports-0.10.3 lib/thinreports/generator/pdf/drawer/list_section.rb
thinreports-0.10.2 lib/thinreports/generator/pdf/drawer/list_section.rb
thinreports-0.10.1 lib/thinreports/generator/pdf/drawer/list_section.rb
thinreports-0.10.0 lib/thinreports/generator/pdf/drawer/list_section.rb