Class: String

Inherits:
Object
  • Object
show all
Defined in:
lib/benchcc/ext/string.rb

Instance Method Summary collapse

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_heredocObject

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