Here's a (long) one-liner to do the same, taking advantage of
pack/unpack's "b" specifier:

str.scan(/.{1,8}/m).map{ |s| s.reverse
}.join.unpack('b*')[0].tr('01','-+').scan(/.{1,64}/).map{ |s| (s << ('
' * 64))[0,64]<< '_' }.join("\n")

Paul.