Sha256: d582d43ef5f34be0c1c20707bc6083411b2efd0dc676045880dfaae5148a1d15

Contents?: true

Size: 1.08 KB

Versions: 2

Compression:

Stored size: 1.08 KB

Contents

# coding: utf-8

module Thinreports
  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 Text::TYPE_NAME       then Text
        when PageNumber::TYPE_NAME then PageNumber
        when *Basic::TYPE_NAMES    then Basic
        else
          raise Thinreports::Errors::UnknownShapeType
        end
      end
    end

  end
end

require 'thinreports/core/shape/style'
require 'thinreports/core/shape/manager'
require 'thinreports/core/shape/base'
require 'thinreports/core/shape/basic'
require 'thinreports/core/shape/text'
require 'thinreports/core/shape/text_block'
require 'thinreports/core/shape/image_block'
require 'thinreports/core/shape/list'
require 'thinreports/core/shape/page_number'

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
thinreports-0.9.1 lib/thinreports/core/shape.rb
thinreports-0.9.0 lib/thinreports/core/shape.rb