Class: Branch::Name::BranchNameService

Inherits:
Object
  • Object
show all
Includes:
Colorizable, Normalizable
Defined in:
lib/branch/name/services/branch_name_service.rb

Constant Summary

Constants included from Normalizable

Normalizable::BRANCH_NAME_REGEX, Normalizable::DEFAULT_PROJECT_FOLDER_TOKEN_SEPARATOR, Normalizable::PROJECT_FOLDER_REGEX, Normalizable::PROJECT_FOLDER_TOKEN_SEPARATORS

Constants included from Colorizable

Colorizable::ABORTED, Colorizable::ERROR, Colorizable::SUCCESS, Colorizable::WARNING

Instance Method Summary collapse

Methods included from Normalizable

#normalize_branch_name, #project_folder_name_from

Constructor Details

#initialize(description:, ticket: nil, options: {}) ⇒ BranchNameService

Returns a new instance of BranchNameService.



12
13
14
15
16
# File 'lib/branch/name/services/branch_name_service.rb', line 12

def initialize(description:, ticket: nil, options: {})
  @description  = description
  @ticket       = ticket
  @options      = options
end

Instance Method Details

#callObject



18
19
20
21
22
23
# File 'lib/branch/name/services/branch_name_service.rb', line 18

def call
  validate_description!
  @branch_name = normalize_branch_name!
  validate_banch_name!
  @branch_name
end