Class: String
- Inherits:
-
Object
- Object
- String
- Defined in:
- lib/benchcc/ext/string.rb
Instance Method Summary collapse
- #quote(char = '"') ⇒ Object
-
#strip_heredoc ⇒ Object
Strip leading whitespace from each line that is the same as the amount of whitespace on the first line of the string.
Instance Method Details
#quote(char = '"') ⇒ Object
2 3 4 |
# File 'lib/benchcc/ext/string.rb', line 2 def quote(char = '"') char + self + char end |
#strip_heredoc ⇒ Object
Strip leading whitespace from each line that is the same as the amount of whitespace on the first line of the string. Leaves additional indentation on later lines intact.
9 10 11 |
# File 'lib/benchcc/ext/string.rb', line 9 def strip_heredoc gsub /^#{self[/\A\s*/]}/, '' end |