class Cp8Cli::BranchName

Constants

SEPARATOR

Attributes

story[R]
user[R]

Public Class Methods

new(user:, story:) click to toggle source
# File lib/cp8_cli/branch_name.rb, line 5
def initialize(user:, story:)
  @user = user
  @story = story
end

Public Instance Methods

to_s() click to toggle source
# File lib/cp8_cli/branch_name.rb, line 10
def to_s
  "#{prefix}#{user_input}"
end

Private Instance Methods

default() click to toggle source
# File lib/cp8_cli/branch_name.rb, line 26
def default
  story.title.parameterize[0..50]
end
prefix() click to toggle source
# File lib/cp8_cli/branch_name.rb, line 22
def prefix
  user.initials.downcase + SEPARATOR
end
user_input() click to toggle source
# File lib/cp8_cli/branch_name.rb, line 18
def user_input
  Command.ask("Branch name: #{prefix}", default: default)
end