lib/docrb/lib/docrb/ruby_parser.rb
def comments_from(line, type:)
      # First, find a comment for the line before this
      comments = []
      comment = comment_for_line(line)

      while comment
        comments << comment
        comment = comment_for_line(line - 1)
        line -= 1
      end

      return nil if comments.empty?

      comments = comments
                 .collect(&:text)
                 .collect { |l| l.gsub(COMMENT_PREFIX, "") }
                 .reverse
                 .join("\n")
      CommentParser.parse(type: type, comment: comments)
    end
# Finds and parses a comment block preceding a given line number.
#
# line  - Integer representing the line being processed.
# type: - Type of node depicted in the provided line number. This is used
#         to provide better utilities to handle the node being commented.
#
# Returns a hash containing the parsed comment.
Finds and parses a comment block preceding a given line number.
line  - Integer representing the line being processed.
type: - Type of node depicted in the provided line number. This is used
to provide better utilities to handle the node being commented.

Returns a hash containing the parsed comment.
Finds and parses a comment block preceding a given line number . line - Integer representing the line being processed . type : - Type of node depicted in the provided line number . This is used to provide better utilities to handle the node being commented . Returns a hash containing the parsed comment .
def comments_from(line, type:)
      comments = []
      comment = comment_for_line(line)
      while comment
        comments << comment
        comment = comment_for_line(line - 1)
        line -= 1
      end
      return nil if comments.empty?
      comments = comments
                 .collect(&:text)
                 .collect { |l| l.gsub(COMMENT_PREFIX, "") }
                 .reverse
                 .join("\n")
      CommentParser.parse(type: type, comment: comments)
    end
def comments_from ( line , type : ) comments = [ ] comment = comment_for_line ( line ) while comment comments << comment comment = comment_for_line ( line - 1 ) line -= 1 end return nil if comments . empty? comments = comments . collect ( & :text ) . collect { | l | l . gsub ( COMMENT_PREFIX , "" ) } . reverse . join ( "\n" ) CommentParser . parse ( type : type , comment : comments ) end
Finds and parses a comment block preceding a given line number.
Finds and parses a comment block preceding a given line number .
# First, find a comment for the line before this
line
type