Permalink
Browse files

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

  • Loading branch information...
1 parent 03cbd96 commit 532b77077fc97211cb9f8d047116a72b8cd286a7 @dre3k dre3k committed with tenderlove Mar 9, 2011
@@ -1 +1 @@
-require 'active_support/core_ext/float/rounding'
+require 'active_support/core_ext/float/rounding' if RUBY_VERSION < '1.9'
@@ -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

0 comments on commit 532b770

Please sign in to comment.