Class: Doing::Item
Overview
This class describes a single WWID item
Constant Summary
Constants included from Color
Color::ATTRIBUTES, Color::ATTRIBUTE_NAMES, Color::COLORED_REGEXP
Instance Attribute Summary collapse
-
#date ⇒ Object
Returns the value of attribute date.
-
#note ⇒ Object
Returns the value of attribute note.
-
#section ⇒ Object
Returns the value of attribute section.
-
#title ⇒ Object
Returns the value of attribute title.
Instance Method Summary collapse
- #calculate_end_date(opt) ⇒ Object
-
#duration ⇒ Object
If the entry doesn't have a @done date, return the elapsed time.
-
#end_date ⇒ Time
Get the value of the item's @done tag.
-
#equal?(other) ⇒ Boolean
Test for equality between items.
-
#expand_date_tags(additional_tags = nil) ⇒ Object
Updates the title of the Item by expanding natural language dates within configured date tags (tags whose value is expected to be a date).
- #highlight_search(search, distance: nil, negate: false, case_type: nil) ⇒ Object
-
#id ⇒ String
Generate a hash that represents the entry.
-
#ignore_case(search, case_type) ⇒ Boolean
Determine if case should be ignored for searches.
-
#initialize(date, title, section, note = nil) ⇒ Item
constructor
Initialize an item with date, title, section, and optional note.
-
#interval ⇒ Object
Get the difference between the item's start date and the value of its @done tag (if present).
-
#move_to(new_section, label: true, log: true) ⇒ Object
Move item from current section to destination section.
-
#overlapping_time?(item_b) ⇒ Boolean
Test if the interval between start date and @done value overlaps with another item's.
-
#same_time?(item_b) ⇒ Boolean
Test if two items occur at the same time (same start date and equal duration).
-
#search(search, distance: nil, negate: false, case_type: nil) ⇒ Boolean
Test if item matches search string.
-
#should_finish? ⇒ Boolean
Test if item is included in never_finish config and thus should not receive a @done tag.
-
#should_time? ⇒ Boolean
Test if item is included in never_time config and thus should not receive a date on the @done tag.
-
#tag(tags, **options) ⇒ Object
Add (or remove) tags from the title of the item.
-
#tag_array ⇒ Array
convert tags on item to an array with @ symbols removed.
-
#tag_values?(queries, bool = :and, negate: false) ⇒ Boolean
Test if item matches tag values.
-
#tags ⇒ Array
Get a list of tags on the item.
-
#tags?(tags, bool = :and, negate: false) ⇒ Boolean
Test if item contains tag(s).
-
#to_pretty(elements: %i[date title section]) ⇒ Object
outputs a colored string with relative date and highlighted tags.
-
#to_s ⇒ Object
outputs item in Doing file format, including leading tab.
Methods included from Color
attributes, coloring?, #support?, #uncolor
Constructor Details
#initialize(date, title, section, note = nil) ⇒ Item
Initialize an item with date, title, section, and optional note
Instance Attribute Details
#date ⇒ Object
Returns the value of attribute date.
#note ⇒ Object
Returns the value of attribute note.
#section ⇒ Object
Returns the value of attribute section.
#title ⇒ Object
Returns the value of attribute title.
Instance Method Details
#calculate_end_date(opt) ⇒ Object
#duration ⇒ Object
If the entry doesn't have a @done date, return the elapsed time
#end_date ⇒ Time
Get the value of the item's @done tag
#equal?(other) ⇒ Boolean
Test for equality between items
#expand_date_tags(additional_tags = nil) ⇒ Object
Updates the title of the Item by expanding natural language dates within configured date tags (tags whose value is expected to be a date)
#highlight_search(search, distance: nil, negate: false, case_type: nil) ⇒ Object
#id ⇒ String
Generate a hash that represents the entry
#ignore_case(search, case_type) ⇒ Boolean
Determine if case should be ignored for searches
#interval ⇒ Object
Get the difference between the item's start date and the value of its @done tag (if present)
#move_to(new_section, label: true, log: true) ⇒ Object
Move item from current section to destination section
#overlapping_time?(item_b) ⇒ Boolean
Test if the interval between start date and @done value overlaps with another item's
#same_time?(item_b) ⇒ Boolean
Test if two items occur at the same time (same start date and equal duration)
#search(search, distance: nil, negate: false, case_type: nil) ⇒ Boolean
Test if item matches search string
#should_finish? ⇒ Boolean
Test if item is included in never_finish config and thus should not receive a @done tag
#should_time? ⇒ Boolean
Test if item is included in never_time config and thus should not receive a date on the @done tag
#tag(tags, **options) ⇒ Object
Add (or remove) tags from the title of the item
#tag_array ⇒ Array
convert tags on item to an array with @ symbols removed
#tag_values?(queries, bool = :and, negate: false) ⇒ Boolean
Test if item matches tag values
#tags ⇒ Array
Get a list of tags on the item
#tags?(tags, bool = :and, negate: false) ⇒ Boolean
Test if item contains tag(s)
#to_pretty(elements: %i[date title section]) ⇒ Object
outputs a colored string with relative date and highlighted tags
#to_s ⇒ Object
outputs item in Doing file format, including leading tab