Class: String
- Inherits:
-
Object
- Object
- String
- Defined in:
- lib/ruby_grammar_builder/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 <<-HEREDOC.remove_indent
This command does such and such.
this part is extra indented
HEREDOC
26 27 28 |
# File 'lib/ruby_grammar_builder/util.rb', line 26 def remove_indent gsub(/^[ \t]{#{match(/^[ \t]*/)[0].length}}/, '') end |