aboutsummaryrefslogtreecommitdiffstats
path: root/guides/source
diff options
context:
space:
mode:
authortinogomes <tinorj@gmail.com>2014-01-08 15:46:42 -0200
committertinogomes <tinorj@gmail.com>2014-01-09 16:02:55 -0200
commit51215937874dd5e8705701c772b41a7ce522f67c (patch)
tree840450f8e54d8c98e4ef2db8c7d176674a547330 /guides/source
parentf4fc9e65ed4d51c50ff117ea337206a11b463eeb (diff)
downloadrails-51215937874dd5e8705701c772b41a7ce522f67c.tar.gz
rails-51215937874dd5e8705701c772b41a7ce522f67c.tar.bz2
rails-51215937874dd5e8705701c772b41a7ce522f67c.zip
Adding Hash#compact and Hash#compact! methods
* Adding Hash#compact and Hash#compact! methods * Using Ruby 1.9 syntax on documentation * Updating guides for `Hash#compact` and `Hash#compact!` methods * Updating CHANGELOG for ActiveSupport * Removing unecessary protected method and lambda for `Hash#compact` implementations * Performing `Hash#compact` implementation - https://gist.github.com/tinogomes/8332883 * fixing order position * Fixing typo
Diffstat (limited to 'guides/source')
-rw-r--r--guides/source/active_support_core_extensions.md10
1 files changed, 10 insertions, 0 deletions
diff --git a/guides/source/active_support_core_extensions.md b/guides/source/active_support_core_extensions.md
index 1a43bd206e..59dfefd22f 100644
--- a/guides/source/active_support_core_extensions.md
+++ b/guides/source/active_support_core_extensions.md
@@ -2907,6 +2907,16 @@ The method `with_indifferent_access` returns an `ActiveSupport::HashWithIndiffer
NOTE: Defined in `active_support/core_ext/hash/indifferent_access.rb`.
+### Compacting
+
+The methods `compact` and `compact!` return a Hash without items with `nil` value.
+
+```ruby
+{a: 1, b: 2, c: nil}.compact # => {a: 1, b: 2}
+```
+
+NOTE: Defined in `active_support/core_ext/hash/compact.rb`.
+
Extensions to `Regexp`
----------------------