Class: Loca::Git::BranchDeleter

Inherits:
Object
  • Object
show all
Includes:
Common, Utils
Defined in:
lib/loca/git/branch_deleter.rb

Instance Method Summary collapse

Methods included from Utils

non_empty_string?

Methods included from Common

#branches, #git, #git_urls_match?, #run_git_checkers

Constructor Details

#initialize(branch) ⇒ BranchDeleter

Returns a new instance of BranchDeleter.



7
8
9
# File 'lib/loca/git/branch_deleter.rb', line 7

def initialize(branch)
  @branch = branch
end

Instance Method Details

#deleteObject



11
12
13
14
15
16
# File 'lib/loca/git/branch_deleter.rb', line 11

def delete
  run_git_checkers
  # Cannot delete a branch you are currently on:
  checkout_another_branch if @branch == current_branch
  git "branch -D #{@branch}"
end