Sha256: 1bd35505829aadf9a1559fd1ce426a7507a3d3989fe8f2fc5b85d0f0428b32d1

Contents?: true

Size: 1.07 KB

Versions: 5

Compression:

Stored size: 1.07 KB

Contents

# frozen_string_literal: true

module Thinreports
  module BasicReport
    module Core
      module Shape
        module TextBlock
          module Formatter
            include Utils

            # @param [Thinreports::BasicReport::Core::Shape::TextBlock::Format] format
            # @return [Thinreports::BasicReport::Core::Shape::TextBlock::Formatter::Base]
            def self.setup(format)
              klass =
                if 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::BasicReport::Errors::UnknownFormatterType
                  end
                end
              klass.new(format)
            end
          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

5 entries across 5 versions & 1 rubygems

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