diff options
author | Bernard Potocki <bernard.potocki@imanel.org> | 2015-05-05 23:57:56 +0200 |
---|---|---|
committer | Bernard Potocki <bernard.potocki@imanel.org> | 2015-05-28 13:51:36 +0200 |
commit | f61dd4f9d4c48b1d447b499d0541d2f6421aedd7 (patch) | |
tree | a0557c915c0885217804ca3e6bc424b0642ebe7c /guides | |
parent | 3ed6d2f3528ae2f2c656ee8bdc9bc07c643c3e25 (diff) | |
download | rails-f61dd4f9d4c48b1d447b499d0541d2f6421aedd7.tar.gz rails-f61dd4f9d4c48b1d447b499d0541d2f6421aedd7.tar.bz2 rails-f61dd4f9d4c48b1d447b499d0541d2f6421aedd7.zip |
Unify behavior of all Numeric extensions and use Module.prepend instead of alias_method
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 2a643680f7..fa88ffb9b2 100644 --- a/guides/source/active_support_core_extensions.md +++ b/guides/source/active_support_core_extensions.md @@ -2071,30 +2071,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` |