diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2014-01-09 10:14:25 -0800 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2014-01-09 10:14:25 -0800 |
commit | a67f25d50b5dd9585bb10ecd19bee6a34d69de6a (patch) | |
tree | 7905eb28c88cd6eb900c59beb23c12166bf868dd /guides | |
parent | 4c32b729517a9a94e3d2a43f76df864fc5fc6e77 (diff) | |
parent | 51215937874dd5e8705701c772b41a7ce522f67c (diff) | |
download | rails-a67f25d50b5dd9585bb10ecd19bee6a34d69de6a.tar.gz rails-a67f25d50b5dd9585bb10ecd19bee6a34d69de6a.tar.bz2 rails-a67f25d50b5dd9585bb10ecd19bee6a34d69de6a.zip |
Merge pull request #13632 from tinogomes/master
Adding Hash#compact and Hash#compact! methods
Diffstat (limited to 'guides')
-rw-r--r-- | guides/source/active_support_core_extensions.md | 10 |
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` ---------------------- |