# File lib/thinking_sphinx/float_formatter.rb, line 4 def initialize(float) @float = float end
# File lib/thinking_sphinx/float_formatter.rb, line 8 def fixed return float.to_s unless exponent_present? ("%0.#{decimal_places}f" % float).gsub(/0+$/, '') end
# File lib/thinking_sphinx/float_formatter.rb, line 30 def decimal_places exponent_factor + exponent_decimal_places end
# File lib/thinking_sphinx/float_formatter.rb, line 18 def exponent_decimal_places float.to_s[PATTERN, 1].length end
# File lib/thinking_sphinx/float_formatter.rb, line 22 def exponent_factor float.to_s[PATTERN, 2].to_i end
# File lib/thinking_sphinx/float_formatter.rb, line 26 def exponent_present? float.to_s['e'] end