Sha256: c8c6a97b7d709a444e492a7c6e02774eb54cab33471feaf2dba87104fad05224

Contents?: true

Size: 1.01 KB

Versions: 5

Compression:

Stored size: 1.01 KB

Contents

# frozen_string_literal: true

module Thinreports
  module BasicReport
    module Core
      module Shape
        module StackView
          class RowFormat < Core::Format::Base
            config_reader :id
            config_reader :height
            config_checker true, :display
            config_checker true, auto_stretch: 'auto-stretch'

            attr_reader :items

            def initialize(*)
              super
              @items = []
              @item_with_ids = {}
              initialize_items(attributes['items'])
            end

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

            private

            def initialize_items(item_schemas)
              item_schemas.each do |item_schema|
                item = Core::Shape::Format(item_schema['type']).new(item_schema)
                @items << item
                @item_with_ids[item.id.to_sym] = item unless item.id.empty?
              end
            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/core/shape/stack_view/row_format.rb
thinreports-0.14.1 lib/thinreports/basic_report/core/shape/stack_view/row_format.rb
thinreports-0.14.0 lib/thinreports/basic_report/core/shape/stack_view/row_format.rb
thinreports-0.13.1 lib/thinreports/basic_report/core/shape/stack_view/row_format.rb
thinreports-0.13.0 lib/thinreports/basic_report/core/shape/stack_view/row_format.rb