aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/core_ext/hash
diff options
context:
space:
mode:
authorErik Michaels-Ober <sferik@gmail.com>2014-10-27 17:28:53 +0100
committerErik Michaels-Ober <sferik@gmail.com>2014-11-29 11:53:24 +0100
commitd1374f99bf3090f3e659687c112ed0c5c0865cfb (patch)
treee87455ea620155254511180cc1f08c5544ed195c /activesupport/lib/active_support/core_ext/hash
parent56e47cf66d2e3009b4032d0cd2ceb1a6e5e42573 (diff)
downloadrails-d1374f99bf3090f3e659687c112ed0c5c0865cfb.tar.gz
rails-d1374f99bf3090f3e659687c112ed0c5c0865cfb.tar.bz2
rails-d1374f99bf3090f3e659687c112ed0c5c0865cfb.zip
Pass symbol as an argument instead of a block
Diffstat (limited to 'activesupport/lib/active_support/core_ext/hash')
-rw-r--r--activesupport/lib/active_support/core_ext/hash/keys.rb8
1 files changed, 4 insertions, 4 deletions
diff --git a/activesupport/lib/active_support/core_ext/hash/keys.rb b/activesupport/lib/active_support/core_ext/hash/keys.rb
index f4105f66b0..9297a59c46 100644
--- a/activesupport/lib/active_support/core_ext/hash/keys.rb
+++ b/activesupport/lib/active_support/core_ext/hash/keys.rb
@@ -31,13 +31,13 @@ class Hash
# hash.stringify_keys
# # => {"name"=>"Rob", "age"=>"28"}
def stringify_keys
- transform_keys{ |key| key.to_s }
+ transform_keys(&:to_s)
end
# Destructively convert all keys to strings. Same as
# +stringify_keys+, but modifies +self+.
def stringify_keys!
- transform_keys!{ |key| key.to_s }
+ transform_keys!(&:to_s)
end
# Returns a new hash with all keys converted to symbols, as long as
@@ -105,14 +105,14 @@ class Hash
# hash.deep_stringify_keys
# # => {"person"=>{"name"=>"Rob", "age"=>"28"}}
def deep_stringify_keys
- deep_transform_keys{ |key| key.to_s }
+ deep_transform_keys(&:to_s)
end
# Destructively convert all keys to strings.
# This includes the keys from the root hash and from all
# nested hashes and arrays.
def deep_stringify_keys!
- deep_transform_keys!{ |key| key.to_s }
+ deep_transform_keys!(&:to_s)
end
# Returns a new hash with all keys converted to symbols, as long as