Sha256: aec16a92d8ea5aa1f84061bf51af13ca4fc631ad37043fdf8bd1212e75c05787

Contents?: true

Size: 951 Bytes

Versions: 2

Compression:

Stored size: 951 Bytes

Contents

# frozen_string_literal: true

module Thinreports
  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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
thinreports-0.12.1 lib/thinreports/core/shape/stack_view/row_format.rb
thinreports-0.12.0 lib/thinreports/core/shape/stack_view/row_format.rb