module Thinreports::Core::Shape::TextBlock::Formatter

Public Class Methods

setup(format) click to toggle source

@param [Thinreports::Core::Shape::TextBlock::Format] format @return [Thinreports::Core::Shape::TextBlock::Formatter::Base]

# File lib/thinreports/core/shape/text_block/formatter.rb, line 10
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