Class: String
- Inherits:
-
Object
- Object
- String
- Defined in:
- lib/textmate_grammar/util.rb
Overview
Add remove indent to the String class
Instance Method Summary collapse
-
#remove_indent ⇒ String
a helper for writing multi-line strings for error messages example usage puts <<-HEREDOC.remove_indent This command does such and such.
Instance Method Details
#remove_indent ⇒ String
a helper for writing multi-line strings for error messages example usage
puts "This command does such and such.\n this part is extra indented\n".remove_indent
25 26 27 |
# File 'lib/textmate_grammar/util.rb', line 25 def remove_indent gsub(/^[ \t]{#{match(/^[ \t]*/)[0].length}}/, '') end |