1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Use Rubys own Float#round method in versions 1.9 and above

This commit is contained in:
Andrei Kulakov 2011-03-10 01:22:56 +08:00 committed by Aaron Patterson
parent 03cbd9672c
commit 532b77077f
2 changed files with 2 additions and 2 deletions

View file

@ -1 +1 @@
require 'active_support/core_ext/float/rounding'
require 'active_support/core_ext/float/rounding' if RUBY_VERSION < '1.9'

View file

@ -1818,7 +1818,7 @@ h3. Extensions to +Float+
h4. +round+
The built-in method +Float#round+ rounds a float to the nearest integer. Active Support adds an optional parameter to let you specify a precision:
The built-in method +Float#round+ rounds a float to the nearest integer. In Ruby 1.9 this method takes optional parameter to let you specify a precision. Active Support adds that functionality to +round+ in previous versions of Ruby:
<ruby>
Math::E.round(4) # => 2.7183