Skip to content

Instantly share code, notes, and snippets.

@dtan4
Created January 31, 2014 12:52
Show Gist options
  • Save dtan4/8731596 to your computer and use it in GitHub Desktop.
Save dtan4/8731596 to your computer and use it in GitHub Desktop.
Transpose text
text = <<-EOS.strip
このあと
滅茶苦茶
サックスした
EOS
text.lines.map{|line|line.strip.ljust(text.lines.map(&:size).max).chars}
.transpose.map(&:join).map(&:reverse).join("\n")
=begin
サ滅こ
ッ茶の
ク苦あ
ス茶と
=end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment