Created
April 28, 2021 02:08
-
-
Save cabo/057075f85ac3140adba335014ce46345 to your computer and use it in GitHub Desktop.
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
def remove_indentation(s) | |
l = s.lines | |
indent = l.grep(/\S/).map {|l| l[/^\s*/].size}.min | |
l.map {|l| l.sub(/^ {0,#{indent}}/, "")}.join | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment