Sha256: 2f784a785cea499641d87e97ccf9ce5f6041de491ae0e3ef09bcf919e6236c7f

Contents?: true

Size: 1.05 KB

Versions: 7

Compression:

Stored size: 1.05 KB

Contents

# frozen_string_literal: true

module Thinreports
  module SectionReport
    module Schema
      module Section
        class Base < Core::Shape::Manager::Format
          config_reader :id, :type
          config_reader :height
          config_checker true, :display
          config_checker true, auto_stretch: 'auto-stretch'

          attr_reader :items

          def initialize(schema_data, items:)
            super(schema_data)
            initialize_items(items)
          end

          def find_item(id)
            @item_with_ids[id.to_sym]
          end

          private

          def initialize_items(items)
            @items = items
            @item_with_ids = items.each_with_object({}) do |item, item_with_ids|
              next if item.id.empty?
              item_with_ids[item.id.to_sym] = item
            end
          end
        end

        class Header < Base
          config_checker true, every_page: 'every-page'
        end

        class Footer < Base
        end

        class Detail < Base
        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/schema/section.rb
thinreports-0.14.1 lib/thinreports/section_report/schema/section.rb
thinreports-0.14.0 lib/thinreports/section_report/schema/section.rb
thinreports-0.13.1 lib/thinreports/section_report/schema/section.rb
thinreports-0.13.0 lib/thinreports/section_report/schema/section.rb
thinreports-0.12.1 lib/thinreports/section_report/schema/section.rb
thinreports-0.12.0 lib/thinreports/section_report/schema/section.rb