Class: Doing::Items
- Defined in:
- lib/doing/items/items.rb,
lib/doing/items/util.rb,
lib/doing/items/filter.rb,
lib/doing/items/modify.rb,
lib/doing/items/sections.rb
Overview
A collection of Item objects
Instance Attribute Summary collapse
-
#sections ⇒ Object
Returns the value of attribute sections.
Instance Method Summary collapse
-
#add_section(section, log: false) ⇒ Object
Add a new section to the sections array.
-
#all_tags ⇒ Array
Get all tags on Items in self.
-
#between_dates(start, finish) ⇒ Items
Filter Items by date.
-
#dedup(match_section: true) ⇒ Items
Remove duplicated entries.
- #dedup!(match_section: true) ⇒ Object
-
#delete(item) ⇒ Object
Create a deep copy of Items def clone Marshal.load(Marshal.dump(self)) end.
-
#delete_item(item, single: false) ⇒ Object
Delete an item from the index.
- #delete_section(section, log: false) ⇒ Object
-
#diff(items) ⇒ Hash
Return Items containing items that don't exist in receiver.
-
#find_id(id) ⇒ Object
Find an item by ID.
-
#guess_section(frag, distance: 2) ⇒ Section
Return the best section match for a search query.
-
#in_section(section) ⇒ Items
Get a new Items object containing only items in a specified section.
-
#include?(item, match_section: true) ⇒ Boolean
Test if self includes Item.
-
#index_for_id(id) ⇒ Object
Return the index for an entry matching ID.
-
#initialize ⇒ Items
constructor
A new instance of Items.
-
#search(query, case_type: :smart) ⇒ Items
Search Items for a string (title and note).
-
#section?(section) ⇒ Boolean
Test if section already exists.
-
#section_titles ⇒ Array
List sections, title only.
-
#tagged(tags, bool: :and) ⇒ Items
Search items by tags.
-
#to_s ⇒ Object
Output sections and items in Doing file format.
-
#update_item(old_item, new_item) ⇒ Object
Update an item in the index with a modified item.
Methods inherited from Array
Methods included from ChronifyArray
#time_string, #to_abbr, #to_natural, #to_years
Constructor Details
#initialize ⇒ Items
Returns a new instance of Items.
Instance Attribute Details
#sections ⇒ Object
Returns the value of attribute sections.
Instance Method Details
#add_section(section, log: false) ⇒ Object
Add a new section to the sections array. Accepts either a Section object, or a title string that will be converted into a Section.
#all_tags ⇒ Array
Get all tags on Items in self
#between_dates(start, finish) ⇒ Items
Filter Items by date. String arguments will be chronified
#dedup(match_section: true) ⇒ Items
Remove duplicated entries. Duplicate entries must have matching start date, title, note, and section
#dedup!(match_section: true) ⇒ Object
#delete(item) ⇒ Object
Create a deep copy of Items
def clone Marshal.load(Marshal.dump(self)) end
#delete_item(item, single: false) ⇒ Object
Delete an item from the index
#delete_section(section, log: false) ⇒ Object
#diff(items) ⇒ Hash
Return Items containing items that don't exist in receiver
#find_id(id) ⇒ Object
Find an item by ID
#guess_section(frag, distance: 2) ⇒ Section
Return the best section match for a search query
#in_section(section) ⇒ Items
Get a new Items object containing only items in a specified section
#include?(item, match_section: true) ⇒ Boolean
Test if self includes Item
#index_for_id(id) ⇒ Object
Return the index for an entry matching ID
#search(query, case_type: :smart) ⇒ Items
Search Items for a string (title and note)
#section?(section) ⇒ Boolean
Test if section already exists
#section_titles ⇒ Array
List sections, title only
#tagged(tags, bool: :and) ⇒ Items
Search items by tags
#to_s ⇒ Object
Output sections and items in Doing file format
#update_item(old_item, new_item) ⇒ Object
Update an item in the index with a modified item