Class: TaskList::Summary
- Inherits:
-
Struct
- Object
- Struct
- TaskList::Summary
- Defined in:
- lib/task_list/summary.rb
Overview
Provides a summary of provided TaskList ‘items`.
‘items` is an Array of TaskList::Item objects.
Instance Attribute Summary collapse
-
#items ⇒ Object
Returns the value of attribute items.
Instance Method Summary collapse
-
#complete_count ⇒ Object
Public: returns the number of complete TaskList::Item objects.
-
#incomplete_count ⇒ Object
Public: returns the number of incomplete TaskList::Item objects.
-
#item_count ⇒ Object
Public: returns the number of TaskList::Item objects.
-
#items? ⇒ Boolean
Public: returns true if there are any TaskList::Item objects.
Instance Attribute Details
#items ⇒ Object
Returns the value of attribute items
9 10 11 |
# File 'lib/task_list/summary.rb', line 9 def items @items end |
Instance Method Details
#complete_count ⇒ Object
Public: returns the number of complete TaskList::Item objects.
21 22 23 |
# File 'lib/task_list/summary.rb', line 21 def complete_count items.select{ |i| i.complete? }.size end |
#incomplete_count ⇒ Object
Public: returns the number of incomplete TaskList::Item objects.
26 27 28 |
# File 'lib/task_list/summary.rb', line 26 def incomplete_count items.select{ |i| !i.complete? }.size end |
#item_count ⇒ Object
Public: returns the number of TaskList::Item objects.
16 17 18 |
# File 'lib/task_list/summary.rb', line 16 def item_count items.size end |
#items? ⇒ Boolean
Public: returns true if there are any TaskList::Item objects.
11 12 13 |
# File 'lib/task_list/summary.rb', line 11 def items? item_count > 0 end |