Module: Finders
- Defined in:
- lib/my_todo/modules/finders.rb
Instance Method Summary collapse
- #all_items ⇒ Object
- #detailed_statuses ⇒ Object
- #item ⇒ Object
- #item_notes ⇒ Object
- #list_statuses ⇒ Object
Instance Method Details
#all_items ⇒ Object
10 11 12 13 14 15 16 17 18 19 |
# File 'lib/my_todo/modules/finders.rb', line 10 def all_items @items = case [:status] when 'all' Item.all when 'done' Item.where(done: true) else Item.where(done: false) end end |
#detailed_statuses ⇒ Object
21 22 23 |
# File 'lib/my_todo/modules/finders.rb', line 21 def detailed_statuses @detailed_statuses ||= Item::DETAILED_STATUSES end |
#item ⇒ Object
2 3 4 |
# File 'lib/my_todo/modules/finders.rb', line 2 def item @item ||= Item.where(id: [:id]).first end |
#item_notes ⇒ Object
6 7 8 |
# File 'lib/my_todo/modules/finders.rb', line 6 def item_notes @item_notes ||= item.notes end |
#list_statuses ⇒ Object
25 26 27 |
# File 'lib/my_todo/modules/finders.rb', line 25 def list_statuses detailed_statuses.each_with_index {|status, index| say "#{index}: #{status}"} end |