Created
April 13, 2009 01:27
-
-
Save myobie/94204 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
# Extend String so we can keep our haml indented properly | |
class String | |
def indents | |
n = match(/^(\s+)/) | |
n = n.nil? ? 0 : n.captures.first.length | |
gsub(/^\s{0,#{n}}/, "") | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment