aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport
diff options
context:
space:
mode:
authorMark Lee <rails@lazymalevolence.com>2016-05-24 15:40:45 -0700
committerMark Lee <rails@lazymalevolence.com>2016-05-24 15:40:45 -0700
commitbe1b716d77216449438af094170d4b0f61739cda (patch)
treecaad49072c3de87f4cae390d8a37796af026713b /activesupport
parent3ac9956bfc8603cdd9999edeec15219dff02d8a2 (diff)
downloadrails-be1b716d77216449438af094170d4b0f61739cda.tar.gz
rails-be1b716d77216449438af094170d4b0f61739cda.tar.bz2
rails-be1b716d77216449438af094170d4b0f61739cda.zip
Normalize whitespace for Hash#compact documentation [ci skip]
This is a similar change that occurred for Hash#except in #21087.
Diffstat (limited to 'activesupport')
-rw-r--r--activesupport/lib/active_support/core_ext/hash/compact.rb12
1 files changed, 6 insertions, 6 deletions
diff --git a/activesupport/lib/active_support/core_ext/hash/compact.rb b/activesupport/lib/active_support/core_ext/hash/compact.rb
index 5dc9a05ec7..62ea579c65 100644
--- a/activesupport/lib/active_support/core_ext/hash/compact.rb
+++ b/activesupport/lib/active_support/core_ext/hash/compact.rb
@@ -1,9 +1,9 @@
class Hash
# Returns a hash with non +nil+ values.
#
- # hash = { a: true, b: false, c: nil}
- # hash.compact # => { a: true, b: false}
- # hash # => { a: true, b: false, c: nil}
+ # hash = { a: true, b: false, c: nil }
+ # hash.compact # => { a: true, b: false }
+ # hash # => { a: true, b: false, c: nil }
# { c: nil }.compact # => {}
def compact
self.select { |_, value| !value.nil? }
@@ -11,9 +11,9 @@ class Hash
# Replaces current hash with non +nil+ values.
#
- # hash = { a: true, b: false, c: nil}
- # hash.compact! # => { a: true, b: false}
- # hash # => { a: true, b: false}
+ # hash = { a: true, b: false, c: nil }
+ # hash.compact! # => { a: true, b: false }
+ # hash # => { a: true, b: false }
def compact!
self.reject! { |_, value| value.nil? }
end