From: Xavier Noria Date: 2011-05-25T00:29:40+09:00 Subject: Re: Using sprintf() to print a Hash --90e6ba4fbe8089fa7004a4074163 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On Tue, May 24, 2011 at 5:25 PM, I=C3=B1aki Baz Castillo wr= ote: 2011/5/24 Robert Klemme : > >> sprintf(" %-20s %20s", "#{key.to_s}:", value.to_s) > > > > That's overly complicated: you employ two text replacement mechanisms. > Just do > > > > printf(" %-20s: %20s\n", key, value) > > Yes, initially I used key.to_s as I have Symbols as keys and thougth > that a string is required. Note that the colon belongs to the argument though. Otherwise they won't be next to their keys. --90e6ba4fbe8089fa7004a4074163--