Class: Artisan::Stories::StoryNumberer
- Inherits:
-
Object
- Object
- Artisan::Stories::StoryNumberer
- Defined in:
- lib/artisan/stories/story_numberer.rb
Instance Method Summary collapse
-
#initialize(project) ⇒ StoryNumberer
constructor
A new instance of StoryNumberer.
- #next_story_number ⇒ Object
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_number ⇒ Object
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 |