Class: Cldr::Format::Decimal::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/cldr/format/decimal/base.rb

Direct Known Subclasses

Fraction, Integer

Instance Method Summary collapse

Instance Method Details

#interpolate(string, value, orientation = :right) ⇒ Object



5
6
7
8
9
10
11
12
13
14
# File 'lib/cldr/format/decimal/base.rb', line 5

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