diff options
author | Sean Griffin <sean@seantheprogrammer.com> | 2015-10-20 16:37:39 -0600 |
---|---|---|
committer | Sean Griffin <sean@seantheprogrammer.com> | 2015-10-20 16:37:39 -0600 |
commit | 7e434d6d2d3e8056e3024f6a3ec2db9e0365d10a (patch) | |
tree | e8b8ebf14ff9319615c7bcf60da950379e0d635e /guides | |
parent | 286c1c3aac856d89d2470b738ba8abfdf230fbff (diff) | |
parent | f61dd4f9d4c48b1d447b499d0541d2f6421aedd7 (diff) | |
download | rails-7e434d6d2d3e8056e3024f6a3ec2db9e0365d10a.tar.gz rails-7e434d6d2d3e8056e3024f6a3ec2db9e0365d10a.tar.bz2 rails-7e434d6d2d3e8056e3024f6a3ec2db9e0365d10a.zip |
Merge pull request #20038 from imanel/numeric_prepend
Use Module.prepend instead of alias_method and unify behavior of all Numeric extensions
Diffstat (limited to 'guides')
-rw-r--r-- | guides/source/active_support_core_extensions.md | 14 |
1 files changed, 3 insertions, 11 deletions
diff --git a/guides/source/active_support_core_extensions.md b/guides/source/active_support_core_extensions.md index 5a68f6c869..0799683a94 100644 --- a/guides/source/active_support_core_extensions.md +++ b/guides/source/active_support_core_extensions.md @@ -2073,30 +2073,22 @@ Extensions to `BigDecimal` -------------------------- ### `to_s` -The method `to_s` is aliased to `to_formatted_s`. This provides a convenient way to display a BigDecimal value in floating-point notation: +The method `to_s` provides a default specifier of "F". This means that a simple call to `to_s` will result in floating point representation instead of engineering notation: ```ruby BigDecimal.new(5.00, 6).to_s # => "5.0" ``` -### `to_formatted_s` - -Te method `to_formatted_s` provides a default specifier of "F". This means that a simple call to `to_formatted_s` or `to_s` will result in floating point representation instead of engineering notation: - -```ruby -BigDecimal.new(5.00, 6).to_formatted_s # => "5.0" -``` - and that symbol specifiers are also supported: ```ruby -BigDecimal.new(5.00, 6).to_formatted_s(:db) # => "5.0" +BigDecimal.new(5.00, 6).to_s(:db) # => "5.0" ``` Engineering notation is still supported: ```ruby -BigDecimal.new(5.00, 6).to_formatted_s("e") # => "0.5E1" +BigDecimal.new(5.00, 6).to_s("e") # => "0.5E1" ``` Extensions to `Enumerable` |