Class: TaskWarrior::Annotation
- Inherits:
-
Object
- Object
- TaskWarrior::Annotation
- Includes:
- ActiveModel::Validations, Validations
- Defined in:
- lib/taskwarrior/annotation.rb
Instance Attribute Summary collapse
-
#description ⇒ Object
Returns the value of attribute description.
-
#entry ⇒ Object
Returns the value of attribute entry.
Instance Method Summary collapse
-
#==(other) ⇒ Object
Annotations are value objects.
- #hash ⇒ Object
-
#initialize(description = nil, entry = nil) ⇒ Annotation
constructor
A new instance of Annotation.
- #to_s ⇒ Object
Methods included from Validations
#entry_cannot_be_in_the_future, #must_be_date_or_nil
Constructor Details
#initialize(description = nil, entry = nil) ⇒ Annotation
Returns a new instance of Annotation.
14 15 16 17 |
# File 'lib/taskwarrior/annotation.rb', line 14 def initialize(description = nil, entry = nil) @description = description @entry = entry end |
Instance Attribute Details
#description ⇒ Object
Returns the value of attribute description.
5 6 7 |
# File 'lib/taskwarrior/annotation.rb', line 5 def description @description end |
#entry ⇒ Object
Returns the value of attribute entry.
5 6 7 |
# File 'lib/taskwarrior/annotation.rb', line 5 def entry @entry end |
Instance Method Details
#==(other) ⇒ Object
Annotations are value objects. They have no identity. If entry date and description are the same, the annotations are identical.
29 30 31 32 |
# File 'lib/taskwarrior/annotation.rb', line 29 def ==(other) return false unless other.is_a?(Annotation) entry.eql?(other.entry) && description.eql?(other.description) end |
#hash ⇒ Object
23 24 25 |
# File 'lib/taskwarrior/annotation.rb', line 23 def hash entry.hash + description.hash end |
#to_s ⇒ Object
19 20 21 |
# File 'lib/taskwarrior/annotation.rb', line 19 def to_s "Annotation (#{entry}): #{description}" end |