Method: Inch::Language::JavaScript::Provider::JSDoc::Docstring#without_comment_markers

Defined in:
lib/inch/language/javascript/provider/jsdoc/docstring.rb

#without_comment_markers(text) ⇒ String

Removes the comment markers // /* */ from the given text.

Docstring.new("// test").without_comment_markers
# => "test"

Returns:

  • (String)


73
74
75
76
77
# File 'lib/inch/language/javascript/provider/jsdoc/docstring.rb', line 73

def without_comment_markers(text)
  text.to_s.lines.map do |line|
    line.strip.gsub(/^(\s*(\/\*+|\/\/|\*+\/|\*)+\s?)/m, '')
  end.join("\n").strip
end