Sha256: 87d3def2c925ec58e5866efe9c9b36caa29640daa5784dd85122966b3405a6fb

Contents?: true

Size: 757 Bytes

Versions: 7

Compression:

Stored size: 757 Bytes

Contents

# frozen_string_literal: true

module Thinreports
  module Core
    module Shape
      module TextBlock
        module Formatter
          class Basic
            include Utils

            attr_reader :format

            def initialize(format)
              @format = format
            end

            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

            def apply_format_to(value)
              value
            end

            def applicable?(_value)
              true
            end
          end
        end
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

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