Class: GitHubChangelogGenerator::Entry
- Inherits:
-
Object
- Object
- GitHubChangelogGenerator::Entry
- Defined in:
- lib/github_changelog_generator/generator/entry.rb
Overview
This class generates the content for a single changelog entry. An entry is generally either for a specific tagged release or the collection of unreleased changes.
An entry is comprised of header text followed by a series of sections relating to the entry.
Instance Attribute Summary collapse
-
#content ⇒ Object
readonly
Returns the value of attribute content.
Instance Method Summary collapse
-
#generate_entry_for_tag(pull_requests, issues, newer_tag_name, newer_tag_link, newer_tag_time, older_tag_name) ⇒ String
Generates log entry with header and body.
-
#initialize(options = Options.new({})) ⇒ Entry
constructor
A new instance of Entry.
- #line_labels_for(issue) ⇒ Object
Constructor Details
Instance Attribute Details
permalink #content ⇒ Object (readonly)
Returns the value of attribute content.
16 17 18 |
# File 'lib/github_changelog_generator/generator/entry.rb', line 16 def content @content end |
Instance Method Details
permalink #generate_entry_for_tag(pull_requests, issues, newer_tag_name, newer_tag_link, newer_tag_time, older_tag_name) ⇒ String
Generates log entry with header and body
32 33 34 35 36 37 38 39 40 41 |
# File 'lib/github_changelog_generator/generator/entry.rb', line 32 def generate_entry_for_tag(pull_requests, issues, newer_tag_name, newer_tag_link, newer_tag_time, older_tag_name) # rubocop:disable Metrics/ParameterLists github_site = @options[:github_site] || "https://github.com" project_url = "#{github_site}/#{@options[:user]}/#{@options[:project]}" create_sections @content = generate_header(newer_tag_name, newer_tag_link, newer_tag_time, older_tag_name, project_url) @content += generate_body(pull_requests, issues) @content end |
permalink #line_labels_for(issue) ⇒ Object
[View source]
43 44 45 46 47 48 49 50 |
# File 'lib/github_changelog_generator/generator/entry.rb', line 43 def line_labels_for(issue) labels = if @options[:issue_line_labels] == ["ALL"] issue["labels"] else issue["labels"].select { |label| @options[:issue_line_labels].include?(label["name"]) } end labels.map { |label| " \[[#{label['name']}](#{label['url'].sub('api.github.com/repos', 'github.com')})\]" }.join("") end |