Module: Thinreports::BasicReport::Core::Shape::TextBlock::Formatter

Includes:
Utils
Defined in:
lib/thinreports/basic_report/core/shape/text_block/formatter.rb,
lib/thinreports/basic_report/core/shape/text_block/formatter/basic.rb,
lib/thinreports/basic_report/core/shape/text_block/formatter/number.rb,
lib/thinreports/basic_report/core/shape/text_block/formatter/padding.rb,
lib/thinreports/basic_report/core/shape/text_block/formatter/datetime.rb

Defined Under Namespace

Classes: Basic, Datetime, Number, Padding

Class Method Summary collapse

Methods included from Utils

#blank_value?, #call_block_in, #deep_copy, included

Class Method Details

.setup(format) ⇒ Thinreports::BasicReport::Core::Shape::TextBlock::Formatter::Base

Parameters:

Returns:

  • (Thinreports::BasicReport::Core::Shape::TextBlock::Formatter::Base)


13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/thinreports/basic_report/core/shape/text_block/formatter.rb', line 13

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