Advanced Ruby • Exercise 2/5

Hash Transform

00:00
0
20 points

Instructions

Create a function normalize_user that takes a user hash and:
1. Converts all keys to symbols (using transform_keys)
2. Strips whitespace from all string values (using transform_values)

Hash transformation methods:
ruby
hash.transform_keys { |k| k.to_sym }
hash.transform_values { |v| v.strip }

Example:
```ruby
normalize_user({ "name" => " Alice ", "email" => " a@b.com " })

=> { name: "Alice", email: "a@b.com" }

Your Code

Results

Click "Run Tests" to see results