Class: Artisan::Stories::StoryNumberer

Inherits:
Object
  • Object
show all
Defined in:
lib/artisan/stories/story_numberer.rb

Instance Method Summary collapse

Constructor Details

#initialize(project) ⇒ StoryNumberer

Returns a new instance of StoryNumberer.



4
5
6
# File 'lib/artisan/stories/story_numberer.rb', line 4

def initialize(project)
  @project = project
end

Instance Method Details

#next_story_numberObject



8
9
10
11
12
# File 'lib/artisan/stories/story_numberer.rb', line 8

def next_story_number
  max = 0
  Story.by_project(@project).each {|story| max = story.number if story.number && story.number > max}
  return max + 1
end