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.
660 661 662 663 664 665 666 667 668 |
# File 'lib/hash_delegator.rb', line 660 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 |