class Thinreports::Core::Shape::TextBlock::Formatter::Basic

Attributes

format[R]

Public Class Methods

new(format) click to toggle source
# File lib/thinreports/core/shape/text_block/formatter/basic.rb, line 13
def initialize(format)
  @format = format
end

Public Instance Methods

apply(value) click to toggle source
# File lib/thinreports/core/shape/text_block/formatter/basic.rb, line 17
def apply(value)
  value = apply_format_to(value) if applicable?(value)

  return value if blank_value?(format.format_base)

  format.format_base.gsub(/\{value\}/, value.to_s)
end

Private Instance Methods

applicable?(_value) click to toggle source
# File lib/thinreports/core/shape/text_block/formatter/basic.rb, line 31
def applicable?(_value)
  true
end
apply_format_to(value) click to toggle source
# File lib/thinreports/core/shape/text_block/formatter/basic.rb, line 27
def apply_format_to(value)
  value
end