Class: Keepachangelog::MarkdownPrinter

Inherits:
Printer
  • Object
show all
Defined in:
lib/keepachangelog/printer/markdown.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(versions, options = {}) ⇒ MarkdownPrinter

Returns a new instance of MarkdownPrinter.



6
7
8
9
# File 'lib/keepachangelog/printer/markdown.rb', line 6

def initialize(versions, options = {})
  self.options = options
  self.versions = versions
end

Instance Attribute Details

#optionsObject

Returns the value of attribute options.



3
4
5
# File 'lib/keepachangelog/printer/markdown.rb', line 3

def options
  @options
end

#versionsObject

Returns the value of attribute versions.



4
5
6
# File 'lib/keepachangelog/printer/markdown.rb', line 4

def versions
  @versions
end

Instance Method Details

#to_sObject



11
12
13
14
15
16
17
18
19
# File 'lib/keepachangelog/printer/markdown.rb', line 11

def to_s
  [
    "# #{options[:title] || default_title}",
    clean_intro(options[:intro]) || default_intro,
    '',
    parse_versions(versions),
    anchors
  ].flatten.join("\n")
end