Method: Hash#transform_keys
- Defined in:
- lib/croesus/core_ext/hash.rb
#transform_keys ⇒ Hash
Returns a new hash with all keys converted using the block operation.
45 46 47 48 49 50 51 52 |
# File 'lib/croesus/core_ext/hash.rb', line 45 def transform_keys enum_for(:transform_keys) unless block_given? result = self.class.new each_key do |key| result[yield(key)] = self[key] end result end |