Created
February 4, 2009 07:54
-
-
Save quackingduck/58009 to your computer and use it in GitHub Desktop.
This file contains 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
# removes leading indentation, sometimes nicer than using a heredoc | |
def clip(str) | |
return str unless str.include?("\n") | |
first_indent = str.match(/\n\s*/).to_s | |
str.gsub( first_indent, "\n" ).strip | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment