Class: Changelog::Notifier::Parsers::Markdown

Inherits:
Object
  • Object
show all
Defined in:
lib/changelog/notifier/parsers/markdown.rb

Overview

Parses the given ‘content` as Markdown following the specifications from keepachangelog.com.

Instance Method Summary collapse

Constructor Details

#initialize(content) ⇒ Markdown

Returns a new instance of Markdown.



11
12
13
# File 'lib/changelog/notifier/parsers/markdown.rb', line 11

def initialize(content)
  @content = content
end

Instance Method Details

#extract(version) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/changelog/notifier/parsers/markdown.rb', line 15

def extract(version)
  valid_version?(version) || raise(ArgumentError, 'Invalid version')

  parse!

  version_release_note = detect_version_release_note_for(version)
  version_release_note || raise(Changelog::Notifier::ReleaseNoteNotFound)

  create_hash_from(version_release_note).tap do |hash|
    hash[:url] = fetch_version_url_for(version)
  end
end