Class: WhatTheGem::Changes::RDocParser

Inherits:
Parser show all
Defined in:
lib/whatthegem/changes/rdoc_parser.rb

Overview

FIXME: It kinda duplicates MarkdownParser for the logic, so should be unified somehow?

Instance Attribute Summary

Attributes inherited from Parser

#file

Instance Method Summary collapse

Methods inherited from Parser

call, #initialize, parser_for

Methods included from I::Callable

#to_proc

Constructor Details

This class inherits a constructor from WhatTheGem::Changes::Parser

Instance Method Details

#versionsObject



5
6
7
8
9
10
11
12
13
# File 'lib/whatthegem/changes/rdoc_parser.rb', line 5

def versions
  nodes = I::RDocs.parts(content)
  level = detect_version_level(nodes) # find level of headers which contain version

  sections = sections(nodes, level)
    .select { |title,| title.match?(VERSION_LINE_REGEXP) }
    .map(&method(:make_version))
    .sort_by(&:number) # it is internally converted to Gem::Version, so "1.12" is correctly > "1.2"
end