Class: Torque::Iteration
- Inherits:
-
Object
- Object
- Torque::Iteration
- Defined in:
- lib/torque/iteration.rb
Overview
Stores the data for one finished iteration of a PT project
Instance Attribute Summary collapse
-
#number ⇒ Object
readonly
The iteration’s number.
-
#stories ⇒ Object
readonly
The iteration’s list of stories.
Class Method Summary collapse
-
.sort_list(iterations) ⇒ Object
A list of iterations sorted from most to least recent.
Instance Method Summary collapse
-
#add_story(story) ⇒ Object
Adds story to the list of stories.
-
#initialize(number, stories = []) ⇒ Iteration
constructor
A new instance of Iteration.
-
#sort_stories ⇒ Object
Sorts the list of stories from most to least recent.
Constructor Details
#initialize(number, stories = []) ⇒ Iteration
Returns a new instance of Iteration.
18 19 20 21 22 |
# File 'lib/torque/iteration.rb', line 18 def initialize(number, stories=[]) @number = number @stories = stories end |
Instance Attribute Details
#number ⇒ Object (readonly)
The iteration’s number
9 10 11 |
# File 'lib/torque/iteration.rb', line 9 def number @number end |
#stories ⇒ Object (readonly)
The iteration’s list of stories
13 14 15 |
# File 'lib/torque/iteration.rb', line 13 def stories @stories end |
Class Method Details
.sort_list(iterations) ⇒ Object
Returns A list of iterations sorted from most to least recent.
42 43 44 45 |
# File 'lib/torque/iteration.rb', line 42 def self.sort_list(iterations) sorted = iterations.sort {|i1, i2| Integer(i2.number) - Integer(i1.number) } sorted end |
Instance Method Details
#add_story(story) ⇒ Object
Adds story to the list of stories
28 29 30 |
# File 'lib/torque/iteration.rb', line 28 def add_story(story) @stories << story end |