class Keepachangelog::Parser
Attributes
parsed_content[RW]
Public Class Methods
new()
click to toggle source
# File lib/keepachangelog/parser.rb, line 5 def initialize self.parsed_content = { 'versions' => {} } end
Public Instance Methods
to_json()
click to toggle source
Changelog in JSON format
Example: “`json {“1.0.0”: { “changes”: { “New”: [“Feature A”] } } } “`
# File lib/keepachangelog/parser.rb, line 15 def to_json parsed_content.to_json end
to_md()
click to toggle source
Changelog as Markdown
# File lib/keepachangelog/parser.rb, line 47 def to_md require 'keepachangelog/printer/markdown' p = MarkdownPrinter.new(parsed_content['versions'], title: parsed_content['title'], intro: parsed_content['intro'], section_order: parsed_content['section_order'], url: parsed_content['url']) p.to_s end
to_s()
click to toggle source
Changelog as a Ruby string
Example: “`ruby {“0.1.0”=>{“changes”=>{“New”=>[“Feature A”]}} “`
# File lib/keepachangelog/parser.rb, line 42 def to_s parsed_content.to_s end
to_yaml(path = nil)
click to toggle source
Changelog in YAML format
Example: “`yaml
0.1.0:
changes: New: - Feature A
“`
# File lib/keepachangelog/parser.rb, line 29 def to_yaml(path = nil) path ||= 'changelog' require 'keepachangelog/printer/yaml' p = YamlPrinter.new(parsed_content) p.write(path) end