Class: BashCommentFormatter
Class Method Summary collapse
-
.format_comment(input_string) ⇒ Object
Formats a multi-line string into a format safe for use in Bash comments.
Class Method Details
.format_comment(input_string) ⇒ Object
Formats a multi-line string into a format safe for use in Bash comments.
370 371 372 373 374 375 376 377 378 |
# File 'lib/hash_delegator.rb', line 370 def self.format_comment(input_string) return '# ' if input_string.nil? return '# ' if input_string.empty? formatted = input_string.split("\n").map do |line| "# #{line.gsub('#', '\#')}" end formatted.join("\n") end |