Class: Dependabot::PullRequestCreator::MessageBuilder::TitleBuilder
- Inherits:
-
Object
- Object
- Dependabot::PullRequestCreator::MessageBuilder::TitleBuilder
- Extended by:
- T::Sig
- Defined in:
- lib/dependabot/pull_request_creator/message_builder/title_builder.rb
Overview
Composes a final PR title from a base title + prefix.
Works in two modes:
- With a full PrNamePrefixer (updater path — has source/credentials for commit style auto-detection)
- With just commit_message_options (API path — explicit prefix only, no network calls needed)
Instance Attribute Summary collapse
-
#base_title ⇒ Object
readonly
Returns the value of attribute base_title.
-
#commit_message_options ⇒ Object
readonly
Returns the value of attribute commit_message_options.
-
#dependencies ⇒ Object
readonly
Returns the value of attribute dependencies.
-
#prefixer ⇒ Object
readonly
Returns the value of attribute prefixer.
Class Method Summary collapse
Instance Method Summary collapse
- #build ⇒ Object
-
#initialize(base_title:, prefixer: nil, commit_message_options: nil, dependencies: nil) ⇒ TitleBuilder
constructor
A new instance of TitleBuilder.
Constructor Details
#initialize(base_title:, prefixer: nil, commit_message_options: nil, dependencies: nil) ⇒ TitleBuilder
Returns a new instance of TitleBuilder.
43 44 45 46 47 48 49 50 51 |
# File 'lib/dependabot/pull_request_creator/message_builder/title_builder.rb', line 43 def initialize(base_title:, prefixer: nil, commit_message_options: nil, dependencies: nil) @base_title = base_title @prefixer = prefixer @commit_message_options = T.let( && CommitMessageOptions.from_hash(), T.nilable(CommitMessageOptions) ) @dependencies = dependencies end |
Instance Attribute Details
#base_title ⇒ Object (readonly)
Returns the value of attribute base_title.
24 25 26 |
# File 'lib/dependabot/pull_request_creator/message_builder/title_builder.rb', line 24 def base_title @base_title end |
#commit_message_options ⇒ Object (readonly)
Returns the value of attribute commit_message_options.
30 31 32 |
# File 'lib/dependabot/pull_request_creator/message_builder/title_builder.rb', line 30 def @commit_message_options end |
#dependencies ⇒ Object (readonly)
Returns the value of attribute dependencies.
33 34 35 |
# File 'lib/dependabot/pull_request_creator/message_builder/title_builder.rb', line 33 def dependencies @dependencies end |
#prefixer ⇒ Object (readonly)
Returns the value of attribute prefixer.
27 28 29 |
# File 'lib/dependabot/pull_request_creator/message_builder/title_builder.rb', line 27 def prefixer @prefixer end |
Class Method Details
.multi_ecosystem_base_title(group_name:, update_count:) ⇒ Object
55 56 57 58 |
# File 'lib/dependabot/pull_request_creator/message_builder/title_builder.rb', line 55 def self.multi_ecosystem_base_title(group_name:, update_count:) "bump the \"#{group_name}\" group with " \ "#{update_count} update#{'s' unless update_count == 1} across multiple ecosystems" end |
Instance Method Details
#build ⇒ Object
61 62 63 64 65 |
# File 'lib/dependabot/pull_request_creator/message_builder/title_builder.rb', line 61 def build name = base_title.dup name[0] = T.must(name[0]).capitalize if !name.empty? && capitalize? "#{prefix}#{name}" end |