Class: WhatTheGem::Changes::MarkdownParser

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

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



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

def versions
  nodes = I::Kramdowns.elements(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