Created
January 31, 2014 12:52
-
-
Save dtan4/8731596 to your computer and use it in GitHub Desktop.
Transpose text
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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