Class: Artisan::Stories::StoryCollection
- Inherits:
-
Object
- Object
- Artisan::Stories::StoryCollection
- Includes:
- Enumerable
- Defined in:
- lib/artisan/stories/story_collection.rb
Instance Attribute Summary collapse
-
#stories ⇒ Object
(also: #all)
readonly
Returns the value of attribute stories.
Instance Method Summary collapse
- #all_complete? ⇒ Boolean
- #billable ⇒ Object
- #billable_points ⇒ Object
- #billed ⇒ Object
- #billed_points ⇒ Object
- #billed_points_by_craftsman ⇒ Object
- #completed ⇒ Object
- #completed_points ⇒ Object
- #each(&block) ⇒ Object
- #estimated_points ⇒ Object (also: #points, #total_points)
- #incomplete ⇒ Object
-
#initialize(stories = []) ⇒ StoryCollection
constructor
A new instance of StoryCollection.
Constructor Details
#initialize(stories = []) ⇒ StoryCollection
Returns a new instance of StoryCollection.
9 10 11 |
# File 'lib/artisan/stories/story_collection.rb', line 9 def initialize(stories = []) @stories = stories end |
Instance Attribute Details
#stories ⇒ Object (readonly) Also known as: all
Returns the value of attribute stories.
6 7 8 |
# File 'lib/artisan/stories/story_collection.rb', line 6 def stories @stories end |
Instance Method Details
#all_complete? ⇒ Boolean
53 54 55 |
# File 'lib/artisan/stories/story_collection.rb', line 53 def all_complete? all?(&:complete?) end |
#billable ⇒ Object
13 14 15 |
# File 'lib/artisan/stories/story_collection.rb', line 13 def billable select {|story| !story.nonbillable?} end |
#billable_points ⇒ Object
29 30 31 |
# File 'lib/artisan/stories/story_collection.rb', line 29 def billable_points sum_estimates(billable) end |
#billed ⇒ Object
17 18 19 |
# File 'lib/artisan/stories/story_collection.rb', line 17 def billed select{|s| !s.nonbillable? && s.complete?} end |
#billed_points ⇒ Object
33 34 35 |
# File 'lib/artisan/stories/story_collection.rb', line 33 def billed_points sum_estimates(billed) end |
#billed_points_by_craftsman ⇒ Object
37 38 39 40 |
# File 'lib/artisan/stories/story_collection.rb', line 37 def billed_points_by_craftsman totals = sum_estimates_by_craftsman(billed) totals.keys.collect { |craftsman| {craftsman: craftsman, points: totals[craftsman]} } end |
#completed ⇒ Object
21 22 23 |
# File 'lib/artisan/stories/story_collection.rb', line 21 def completed select(&:complete?) end |
#completed_points ⇒ Object
49 50 51 |
# File 'lib/artisan/stories/story_collection.rb', line 49 def completed_points sum_estimates(completed) end |
#each(&block) ⇒ Object
57 58 59 |
# File 'lib/artisan/stories/story_collection.rb', line 57 def each(&block) stories.each { |story| block.call(story) } end |
#estimated_points ⇒ Object Also known as: points, total_points
42 43 44 |
# File 'lib/artisan/stories/story_collection.rb', line 42 def estimated_points sum_estimates(@stories) end |
#incomplete ⇒ Object
25 26 27 |
# File 'lib/artisan/stories/story_collection.rb', line 25 def incomplete reject(&:complete?) end |