class RDocRuboCop::Lang::C::CommentExtractor

Attributes

comments[R]

Public Class Methods

new(source_file) click to toggle source
# File lib/rdoc_rubocop/lang/c/comment_extractor.rb, line 9
def initialize(source_file)
  @source_file = source_file
  @comments = []
end

Public Instance Methods

extract() click to toggle source
# File lib/rdoc_rubocop/lang/c/comment_extractor.rb, line 14
def extract
  @comments = extract_comments
end

Private Instance Methods

extract_comments() click to toggle source
# File lib/rdoc_rubocop/lang/c/comment_extractor.rb, line 20
def extract_comments
  pos = 0
  comments = []

  while match_data = %r(/\*.*?\*/)m.match(@source_file.source, pos) do
    comments << Comment.build(match_data[0], self, match_data.begin(0), match_data.end(0))
    pos = match_data.end(0)
  end

  comments
end