Here are two additional spins on the theme:
str = ''
{ "a" => "b", "c" => "d" }.each_pair{ |n,v| str << "#{n}=#{v}\n" }
str # => "a=b\nc=d\n"
str = ''
{ "a" => "b", "c" => "d" }.each_pair{ |*e| str << e.join('=') << "\n" }
str # => "a=b\nc=d\n"
I'm on 1.9.2 so the hash order is maintained as each_pair() iterates over it.
Inject()
could be used instead of appending to the end of the str string, but my brain always has to downshift for a second or two to decode what inject is doing. I prefer appending instead, particularly in the second example because it's free of the "#{}"
line-noise.
If you don't want the trailing carriage-return, then @ba has what I'd have gone with, or a quick str.chomp
of what I showed.