Class: Trajectory::Stories
- Inherits:
-
SimpleDelegator
- Object
- SimpleDelegator
- Trajectory::Stories
- Defined in:
- lib/trajectory/domain/stories.rb
Class Method Summary collapse
-
.from_json(project, json_attributes) ⇒ Object
Create a new collection of Story from a JSON array of attributes from trajectory API.
Instance Method Summary collapse
-
#in_iteration(iteration) ⇒ Stories
Returns stories of the collection that are in the given iteration.
-
#initialize(*stories) ⇒ Stories
constructor
Creates a new collection of Story.
-
#not_completed ⇒ Stories
Returns not completed stories of the collection.
-
#started ⇒ Stories
Returns started stories of the collection.
-
#unstarted ⇒ Stories
Returns unstarted stories of the collection.
Constructor Details
#initialize(*stories) ⇒ Stories
Creates a new collection of Trajectory::Story
10 11 12 |
# File 'lib/trajectory/domain/stories.rb', line 10 def initialize(*stories) super(stories) end |
Class Method Details
.from_json(project, json_attributes) ⇒ Object
Create a new collection of Trajectory::Story from a JSON array of attributes from trajectory API
18 19 20 21 22 23 |
# File 'lib/trajectory/domain/stories.rb', line 18 def self.from_json(project, json_attributes) new(*json_attributes.map do |attributes| attributes = attributes.symbolize_keys!.merge({project_id: project.id}) Story.new(attributes) end) end |
Instance Method Details
#in_iteration(iteration) ⇒ Stories
Returns stories of the collection that are in the given iteration
50 51 52 53 54 |
# File 'lib/trajectory/domain/stories.rb', line 50 def in_iteration(iteration) stories.select do |story| story.in_iteration?(iteration) end end |
#not_completed ⇒ Stories
Returns not completed stories of the collection
42 43 44 |
# File 'lib/trajectory/domain/stories.rb', line 42 def not_completed stories.reject(&:completed?) end |
#started ⇒ Stories
Returns started stories of the collection
28 29 30 |
# File 'lib/trajectory/domain/stories.rb', line 28 def started stories.select(&:started?) end |
#unstarted ⇒ Stories
Returns unstarted stories of the collection
35 36 37 |
# File 'lib/trajectory/domain/stories.rb', line 35 def unstarted stories.select(&:unstarted?) end |