Sha256: c7e0f73d5aa61b84b2fb6725f05ab97f5c10892d9ac194a1ac3224aaa17e3c74

Contents?: true

Size: 963 Bytes

Versions: 7

Compression:

Stored size: 963 Bytes

Contents

# frozen_string_literal: true

module Thinreports
  module Core
    module Shape
      module 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
  end
end

require_relative 'formatter/basic'
require_relative 'formatter/datetime'
require_relative 'formatter/padding'
require_relative 'formatter/number'

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
thinreports-0.12.1 lib/thinreports/core/shape/text_block/formatter.rb
thinreports-0.12.0 lib/thinreports/core/shape/text_block/formatter.rb
thinreports-0.11.0 lib/thinreports/core/shape/text_block/formatter.rb
thinreports-0.10.3 lib/thinreports/core/shape/text_block/formatter.rb
thinreports-0.10.2 lib/thinreports/core/shape/text_block/formatter.rb
thinreports-0.10.1 lib/thinreports/core/shape/text_block/formatter.rb
thinreports-0.10.0 lib/thinreports/core/shape/text_block/formatter.rb