Sha256: 163d2f71f761620b17e78a01eaa711af91c86c7a21242059256ae87708ae11d4

Contents?: true

Size: 644 Bytes

Versions: 1

Compression:

Stored size: 644 Bytes

Contents

# coding: utf-8

module ThinReports
  module Core::Shape::Tblock
    
    # @private
    class Formatter::Basic
      attr_reader :format
      
      def initialize(format)
        @format = format
      end
      
      def apply(value)
        if applicable?(value)
          value = apply_format_to(value)
        end
        
        unless format.format_base.blank?
          format.format_base.gsub(/\{value\}/, value.to_s)
        else
          value
        end
      end
    
    private
      
      def apply_format_to(value)
        value
      end
      
      def applicable?(value)
        true
      end
    end
    
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
thinreports-0.6.0.pre3 lib/thinreports/core/shape/tblock/formatter/basic.rb