Changing every value in a hash in Ruby

I want to change every value in a hash so as to add ‘%’ before and after the value so

{ :a=>'a' , :b=>'b' }

must be changed to

{ :a=>'%a%' , :b=>'%b%' }

What’s the best way to do this?

11 Answers
11

Leave a Comment