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-4.1.0 lib/twitter_cldr/formatters/numbers/helpers/base.rb
twitter_cldr-4.0.0 lib/twitter_cldr/formatters/numbers/helpers/base.rb
twitter_cldr-3.6.0 lib/twitter_cldr/formatters/numbers/helpers/base.rb
twitter_cldr-3.5.0 lib/twitter_cldr/formatters/numbers/helpers/base.rb
twitter_cldr-3.4.0 lib/twitter_cldr/formatters/numbers/helpers/base.rb
twitter_cldr-3.3.0 lib/twitter_cldr/formatters/numbers/helpers/base.rb
solidus_backend-1.0.0.pre3 vendor/bundle/gems/twitter_cldr-3.2.1/lib/twitter_cldr/formatters/numbers/helpers/base.rb
solidus_backend-1.0.0.pre2 vendor/bundle/gems/twitter_cldr-3.2.1/lib/twitter_cldr/formatters/numbers/helpers/base.rb
solidus_backend-1.0.0.pre vendor/bundle/gems/twitter_cldr-3.1.2/lib/twitter_cldr/formatters/numbers/helpers/base.rb
twitter_cldr-3.2.1 lib/twitter_cldr/formatters/numbers/helpers/base.rb
twitter_cldr-3.2.0 lib/twitter_cldr/formatters/numbers/helpers/base.rb
twitter_cldr-3.1.2 lib/twitter_cldr/formatters/numbers/helpers/base.rb
twitter_cldr-3.1.1 lib/twitter_cldr/formatters/numbers/helpers/base.rb
twitter_cldr-3.1.0 lib/twitter_cldr/formatters/numbers/helpers/base.rb
twitter_cldr-3.0.10 lib/twitter_cldr/formatters/numbers/helpers/base.rb
twitter_cldr-3.0.9 lib/twitter_cldr/formatters/numbers/helpers/base.rb
twitter_cldr-3.0.8 lib/twitter_cldr/formatters/numbers/helpers/base.rb
twitter_cldr-3.0.7 lib/twitter_cldr/formatters/numbers/helpers/base.rb
twitter_cldr-3.0.6 lib/twitter_cldr/formatters/numbers/helpers/base.rb
twitter_cldr-3.0.5 lib/twitter_cldr/formatters/numbers/helpers/base.rb