Robert Dober wrote:
> (1<<n).times.map{ | d | "%0{n}b" % d }

Perhaps safer to avoid the interpolation in the format string, using '*' 
to give the number of digits.

>> "%0*b" % [8,123]
=> "01111011"
-- 
Posted via http://www.ruby-forum.com/.