aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrei Kulakov <krugliy@gmail.com>2011-03-10 01:22:56 +0800
committerAaron Patterson <aaron.patterson@gmail.com>2011-03-10 01:30:51 +0800
commit532b77077fc97211cb9f8d047116a72b8cd286a7 (patch)
treee5c517e70e4e6de9d3e255f91edf0bf1c1e2841c
parent03cbd9672cfc142842c95aae0fb27b8eb27e6990 (diff)
downloadrails-532b77077fc97211cb9f8d047116a72b8cd286a7.tar.gz
rails-532b77077fc97211cb9f8d047116a72b8cd286a7.tar.bz2
rails-532b77077fc97211cb9f8d047116a72b8cd286a7.zip
Use Rubys own Float#round method in versions 1.9 and above
-rw-r--r--activesupport/lib/active_support/core_ext/float.rb2
-rw-r--r--railties/guides/source/active_support_core_extensions.textile2
2 files changed, 2 insertions, 2 deletions
diff --git a/activesupport/lib/active_support/core_ext/float.rb b/activesupport/lib/active_support/core_ext/float.rb
index 7570471b95..4f6f606680 100644
--- a/activesupport/lib/active_support/core_ext/float.rb
+++ b/activesupport/lib/active_support/core_ext/float.rb
@@ -1 +1 @@
-require 'active_support/core_ext/float/rounding'
+require 'active_support/core_ext/float/rounding' if RUBY_VERSION < '1.9'
diff --git a/railties/guides/source/active_support_core_extensions.textile b/railties/guides/source/active_support_core_extensions.textile
index 1df36137b4..39a87d9f64 100644
--- a/railties/guides/source/active_support_core_extensions.textile
+++ b/railties/guides/source/active_support_core_extensions.textile
@@ -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