Class: PGit::StoryBranch::StoryIdParser

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

Instance Method Summary collapse

Constructor Details

#initialize(branch_name) ⇒ StoryIdParser

Returns a new instance of StoryIdParser.



2
3
4
# File 'lib/pgit/story_branch/story_id_parser.rb', line 2

def initialize(branch_name)
  @branch_name = branch_name
end

Instance Method Details

#parseObject

Raises:



6
7
8
9
10
# File 'lib/pgit/story_branch/story_id_parser.rb', line 6

def parse
  raise PGit::Error::User, "The current branch is not associated with a story. Does not have a story id." unless @branch_name.match(/\d+$/)

  @branch_name.match(/\d+$/)[0]
end