Method: FormatR::NumberFormatter#getFract

Defined in:
lib/formatr.rb

#getFract(num, spaceLeft) ⇒ Object

what portion of the number is after the decimal point and should be printed



576
577
578
579
580
581
582
583
584
585
586
# File 'lib/formatr.rb', line 576

def getFract (num, spaceLeft)
  num[1] = "" if (num[1].nil?)
  @fraction.times {num[1] += '0'}
  fract = num[1][0,spaceLeft + 1]
  if (fract.size() >= spaceLeft + 1)
    if ((fract[spaceLeft,1].to_i) >= 5 )
      fract[spaceLeft - 1, 1] = ((fract[spaceLeft - 1, 1].to_i) + 1).to_s
    end
  end
  return fract[0,spaceLeft] 
end