Sha256: 129c5d68065cacd309d469796bb43f744794f0f34d73a1af12e4bbd6e9174e30

Contents?: true

Size: 935 Bytes

Versions: 3

Compression:

Stored size: 935 Bytes

Contents

# coding: utf-8

module Thinreports
  module Core::Shape::TextBlock

    module Formatter
      # @param [Thinreports::Core::Shape::TextBlock::Format] format
      # @return [Thinreports::Core::Shape::TextBlock::Formatter::Base]
      def self.setup(format)
        klass =
          if Thinreports.blank_value?(format.format_type)
            Basic
          else
            case format.format_type
            when 'number'   then Number
            when 'datetime' then Datetime
            when 'padding'  then Padding
            else
              raise Thinreports::Errors::UnknownFormatterType
            end
          end
        klass.new(format)
      end
    end

  end
end

require 'thinreports/core/shape/text_block/formatter/basic'
require 'thinreports/core/shape/text_block/formatter/datetime'
require 'thinreports/core/shape/text_block/formatter/padding'
require 'thinreports/core/shape/text_block/formatter/number'

Version data entries

3 entries across 3 versions & 1 rubygems

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