Class: PGit::CurrentBranch

Inherits:
Object
  • Object
show all
Defined in:
lib/pgit/current_branch.rb

Instance Method Summary collapse

Constructor Details

#initializeCurrentBranch

Returns a new instance of CurrentBranch.

Raises:

  • (@branches)


3
4
5
6
7
# File 'lib/pgit/current_branch.rb', line 3

def initialize
  @branches = `git branch`

  raise @branches unless current.any?
end

Instance Method Details

#nameObject



9
10
11
# File 'lib/pgit/current_branch.rb', line 9

def name
  current.first.gsub(/\*\s*/, '')
end

#story_idObject



13
14
15
# File 'lib/pgit/current_branch.rb', line 13

def story_id
  name.scan(/\d+$/).first
end