Sha256: a9fd9bb0f4f842787356d07c7a5665055a40d3d0dda71683c512da68f4694c5a

Contents?: true

Size: 1.19 KB

Versions: 5

Compression:

Stored size: 1.19 KB

Contents

# frozen_string_literal: true

module Thinreports
  module BasicReport
    module Core
      module Shape
        def Interface(parent, format)
          find_by_type(format.type)::Interface.new(parent, format)
        end

        def Format(type)
          find_by_type(type)::Format
        end

        module_function :Interface, :Format

        def self.find_by_type(type)
          case type
          when TextBlock::TYPE_NAME  then TextBlock
          when ImageBlock::TYPE_NAME then ImageBlock
          when List::TYPE_NAME       then List
          when StackView::TYPE_NAME  then StackView
          when Text::TYPE_NAME       then Text
          when PageNumber::TYPE_NAME then PageNumber
          when *Basic::TYPE_NAMES    then Basic
          else
            raise Thinreports::BasicReport::Errors::UnknownShapeType
          end
        end
      end
    end
  end
end

require_relative 'shape/style'
require_relative 'shape/manager'
require_relative 'shape/base'
require_relative 'shape/basic'
require_relative 'shape/text'
require_relative 'shape/text_block'
require_relative 'shape/image_block'
require_relative 'shape/list'
require_relative 'shape/stack_view'
require_relative 'shape/page_number'

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
thinreports-0.14.2 lib/thinreports/basic_report/core/shape.rb
thinreports-0.14.1 lib/thinreports/basic_report/core/shape.rb
thinreports-0.14.0 lib/thinreports/basic_report/core/shape.rb
thinreports-0.13.1 lib/thinreports/basic_report/core/shape.rb
thinreports-0.13.0 lib/thinreports/basic_report/core/shape.rb