Sha256: e23b621457f5da05fa9fd747e78adaf5560b5aa1052263fb18e120a64350e8f6

Contents?: true

Size: 559 Bytes

Versions: 76

Compression:

Stored size: 559 Bytes

Contents

# encoding: UTF-8

# Copyright 2012 Twitter, Inc
# http://www.apache.org/licenses/LICENSE-2.0

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

          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

76 entries across 76 versions & 3 rubygems

Version Path
twitter_cldr-6.13.0 lib/twitter_cldr/formatters/numbers/helpers/base.rb
twitter_cldr-6.12.1 lib/twitter_cldr/formatters/numbers/helpers/base.rb
twitter_cldr-6.12.0 lib/twitter_cldr/formatters/numbers/helpers/base.rb
twitter_cldr-6.11.5 lib/twitter_cldr/formatters/numbers/helpers/base.rb
twitter_cldr-6.11.4 lib/twitter_cldr/formatters/numbers/helpers/base.rb
twitter_cldr-6.11.3 lib/twitter_cldr/formatters/numbers/helpers/base.rb
twitter_cldr-6.11.2 lib/twitter_cldr/formatters/numbers/helpers/base.rb
twitter_cldr-6.11.1 lib/twitter_cldr/formatters/numbers/helpers/base.rb
twitter_cldr-6.11.0 lib/twitter_cldr/formatters/numbers/helpers/base.rb
twitter_cldr-6.10.0 lib/twitter_cldr/formatters/numbers/helpers/base.rb
twitter_cldr-6.9.0 lib/twitter_cldr/formatters/numbers/helpers/base.rb
twitter_cldr-6.8.0 lib/twitter_cldr/formatters/numbers/helpers/base.rb
twitter_cldr-6.7.0 lib/twitter_cldr/formatters/numbers/helpers/base.rb
twitter_cldr-6.6.2 lib/twitter_cldr/formatters/numbers/helpers/base.rb
twitter_cldr-6.6.1 lib/twitter_cldr/formatters/numbers/helpers/base.rb
twitter_cldr-6.6.0 lib/twitter_cldr/formatters/numbers/helpers/base.rb
twitter_cldr-6.5.0 lib/twitter_cldr/formatters/numbers/helpers/base.rb
twitter_cldr-6.4.0 lib/twitter_cldr/formatters/numbers/helpers/base.rb
twitter_cldr-6.3.0 lib/twitter_cldr/formatters/numbers/helpers/base.rb
twitter_cldr-6.2.0 lib/twitter_cldr/formatters/numbers/helpers/base.rb