From b0a8c21f51b18b7ac694408e599fd170a15e4162 Mon Sep 17 00:00:00 2001 From: Olle Jonsson Date: Sat, 11 Apr 2020 22:36:32 +0200 Subject: [PATCH 1/2] Section: turn all accessors into readers - the writers were never used, so we can do without them --- .../generator/section.rb | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/lib/github_changelog_generator/generator/section.rb b/lib/github_changelog_generator/generator/section.rb index 49e2c00dc..0142508bb 100644 --- a/lib/github_changelog_generator/generator/section.rb +++ b/lib/github_changelog_generator/generator/section.rb @@ -7,7 +7,23 @@ module GitHubChangelogGenerator # # @see GitHubChangelogGenerator::Entry class Section - attr_accessor :name, :options, :prefix, :issues, :labels, :body_only + # @return [String] + attr_accessor :name + + # @return [String] a merge prefix, or an issue prefix + attr_reader :prefix + + # @return [Array] + attr_reader :issues + + # @return [Array] + attr_reader :labels + + # @return [Boolean] + attr_reader :body_only + + # @return [Options] + attr_reader :options def initialize(opts = {}) @name = opts[:name] From b81a5f9b9a6703907d831c65cd68293f9d993310 Mon Sep 17 00:00:00 2001 From: Olle Jonsson Date: Sat, 11 Apr 2020 22:43:01 +0200 Subject: [PATCH 2/2] Section: Avoid recreating an instance --- lib/github_changelog_generator/generator/section.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/github_changelog_generator/generator/section.rb b/lib/github_changelog_generator/generator/section.rb index 0142508bb..5ef8dab94 100644 --- a/lib/github_changelog_generator/generator/section.rb +++ b/lib/github_changelog_generator/generator/section.rb @@ -32,6 +32,7 @@ def initialize(opts = {}) @issues = opts[:issues] || [] @options = opts[:options] || Options.new({}) @body_only = opts[:body_only] || false + @entry = Entry.new(options) end # Returns the content of a section. @@ -65,7 +66,7 @@ def get_string_for_issue(issue) encapsulated_title = encapsulate_string issue["title"] title_with_number = "#{encapsulated_title} [\\##{issue['number']}](#{issue['html_url']})" - title_with_number = "#{title_with_number}#{Entry.new(options).line_labels_for(issue)}" if @options[:issue_line_labels].present? + title_with_number = "#{title_with_number}#{@entry.line_labels_for(issue)}" if @options[:issue_line_labels].present? line = issue_line_with_user(title_with_number, issue) issue_line_with_body(line, issue) end pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy