Sha256: 721af11a9aa5473a1a802d90e56af0ad294ccf015f679f768688707153d2997f

Contents?: true

Size: 488 Bytes

Versions: 1

Compression:

Stored size: 488 Bytes

Contents

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.0 lib/formatters/numbers/helpers/base.rb