Method: String#comment_erb
- Defined in:
- lib/openc3/core_ext/string.rb
#comment_erb ⇒ Object
392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 |
# File 'lib/openc3/core_ext/string.rb', line 392 def comment_erb output = self.lines.collect! do |line| # If we have a commented out line that starts with # # but not followed by % (allows for disabling ERB comments), # which contains an ERB statement (<% ...) # then comment out the ERB statement (<%# ...). # We explicitly don't comment out trailing ERB statements # as that is not typical and is difficult to regex if line =~ /^\s*#[^%]*<%/ line.gsub!('<%', '<%#') end line end return output.join("") end |