class Cp8Cli::PullRequestTitle

Attributes

prefixes[R]
title[R]

Public Class Methods

new(title, prefixes: []) click to toggle source
# File lib/cp8_cli/pull_request_title.rb, line 3
def initialize(title, prefixes: [])
  @title = title
  @prefixes = Array(prefixes)
end

Public Instance Methods

run() click to toggle source
# File lib/cp8_cli/pull_request_title.rb, line 8
def run
  title_with_prefixes.presence
end

Private Instance Methods

prefixes_to_text() click to toggle source
# File lib/cp8_cli/pull_request_title.rb, line 21
def prefixes_to_text
  prefixes.map do |prefix|
    "[#{prefix.to_s.upcase}]"
  end.join(" ")
end
title_with_prefixes() click to toggle source
# File lib/cp8_cli/pull_request_title.rb, line 16
def title_with_prefixes
  "#{prefixes_to_text} #{title}".strip
end