Sha256: d3e4c7125307f041a49ac818ab369d793f53b94819a401c895f8796d65a1a949

Contents?: true

Size: 507 Bytes

Versions: 1

Compression:

Stored size: 507 Bytes

Contents

# encoding: UTF-8

module TwitterCldr
  module Formatters
    module Numbers
      class Base
        def interpolate(string, value, orientation = :right)
          value  = value.to_s
          length = value.length
          start, pad = orientation == :left ? [0, :rjust] : [-length, :ljust]

          string = string.dup
          string = string.ljust(length, '#') if string.length < length
          string[start, length] = value
          string.gsub('#', '')
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
twitter_cldr-1.0.1 lib/formatters/numbers/helpers/base.rb