lib/spacebunny/utils.rb
# Returns a new hash with all keys converted using the block operation.
#
#  hash = { name: 'Rob', age: '28' }
#
#  hash.transform_keys{ |key| key.to_s.upcase }
#  # => {"NAME"=>"Rob", "AGE"=>"28"}
Returns a new hash with all keys converted using the block operation.


Returns a new hash with all keys converted using the block operation .
def _deep_transform_keys_in_object!(object, &block)
    case object
      when Hash
        object.keys.each do |key|
          value = object.delete(key)
          object[yield(key)] = _deep_transform_keys_in_object!(value, &block)
        end
        object
      when Array
        object.map! {|e| _deep_transform_keys_in_object!(e, &block)}
      else
        object
    end
  end
def _deep_transform_keys_in_object! ( object , & block ) case object when Hash object . keys . each do | key | value = object . delete ( key ) object [ yield ( key ) ] = _deep_transform_keys_in_object! ( value , & block ) end object when Array object . map! { | e | _deep_transform_keys_in_object! ( e , & block ) } else object end end
Returns a new hash with all keys converted using the block operation.
Returns a new hash with all keys converted using the block operation .
object
block