Class: BaseBranch::GitBranch

Inherits:
Object
  • Object
show all
Defined in:
lib/base_branch/git_branch.rb

Class Method Summary collapse

Class Method Details

.current_branchObject



3
4
5
6
7
8
9
10
# File 'lib/base_branch/git_branch.rb', line 3

def current_branch
  raise(
    BaseBranch::BaseBranchExceptions::UninitializedRepository,
    'Please initialize a git repository and have at least one branch.'
  ) if (branchez = branches).empty?

  (branchez.detect { |br| br[0, 2] == '* ' } || '').gsub('* ', '').chomp
end

.master?Boolean

Returns:

  • (Boolean)


12
13
14
# File 'lib/base_branch/git_branch.rb', line 12

def master?
  current_branch == 'master'
end