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-3.0.4 lib/twitter_cldr/formatters/numbers/helpers/base.rb
twitter_cldr-3.0.3 lib/twitter_cldr/formatters/numbers/helpers/base.rb
twitter_cldr-3.0.2 lib/twitter_cldr/formatters/numbers/helpers/base.rb
twitter_cldr-3.0.1 lib/twitter_cldr/formatters/numbers/helpers/base.rb
twitter_cldr-2.4.3 lib/twitter_cldr/formatters/numbers/helpers/base.rb
twitter_cldr-3.0.0 lib/twitter_cldr/formatters/numbers/helpers/base.rb
twitter_cldr-3.0.0.beta1 lib/twitter_cldr/formatters/numbers/helpers/base.rb
twitter_cldr-2.4.2 lib/twitter_cldr/formatters/numbers/helpers/base.rb
twitter_cldr-2.4.1 lib/twitter_cldr/formatters/numbers/helpers/base.rb
twitter_cldr-2.4.0 lib/twitter_cldr/formatters/numbers/helpers/base.rb
twitter_cldr-2.2.0 lib/twitter_cldr/formatters/numbers/helpers/base.rb
twitter_cldr-2.1.1 lib/twitter_cldr/formatters/numbers/helpers/base.rb
twitter_cldr-2.1.0 lib/twitter_cldr/formatters/numbers/helpers/base.rb
twitter_cldr-2.0.2 lib/twitter_cldr/formatters/numbers/helpers/base.rb
twitter_cldr-2.0.1 lib/twitter_cldr/formatters/numbers/helpers/base.rb
twitter_cldr-2.0.0 lib/twitter_cldr/formatters/numbers/helpers/base.rb