Class: TaskwarriorWeb::Annotation
- Inherits:
-
Object
- Object
- TaskwarriorWeb::Annotation
- Defined in:
- lib/taskwarrior-web/model/annotation.rb
Instance Attribute Summary collapse
-
#_errors ⇒ Object
Returns the value of attribute _errors.
-
#description ⇒ Object
Returns the value of attribute description.
-
#entry ⇒ Object
Returns the value of attribute entry.
-
#task_id ⇒ Object
Returns the value of attribute task_id.
Instance Method Summary collapse
- #delete! ⇒ Object
-
#initialize(attributes = {}) ⇒ Annotation
constructor
A new instance of Annotation.
- #is_valid? ⇒ Boolean
- #save! ⇒ Object
Constructor Details
#initialize(attributes = {}) ⇒ Annotation
Returns a new instance of Annotation.
5 6 7 8 9 10 11 |
# File 'lib/taskwarrior-web/model/annotation.rb', line 5 def initialize(attributes = {}) attributes.each do |attr, value| send("#{attr}=", value) if respond_to?(attr.to_sym) end @_errors = [] end |
Instance Attribute Details
#_errors ⇒ Object
Returns the value of attribute _errors.
3 4 5 |
# File 'lib/taskwarrior-web/model/annotation.rb', line 3 def _errors @_errors end |
#description ⇒ Object
Returns the value of attribute description.
3 4 5 |
# File 'lib/taskwarrior-web/model/annotation.rb', line 3 def description @description end |
#entry ⇒ Object
Returns the value of attribute entry.
3 4 5 |
# File 'lib/taskwarrior-web/model/annotation.rb', line 3 def entry @entry end |
#task_id ⇒ Object
Returns the value of attribute task_id.
3 4 5 |
# File 'lib/taskwarrior-web/model/annotation.rb', line 3 def task_id @task_id end |
Instance Method Details
#delete! ⇒ Object
17 18 19 |
# File 'lib/taskwarrior-web/model/annotation.rb', line 17 def delete! Command.new(:denotate, self.task_id, { :description => self.description }).run end |
#is_valid? ⇒ Boolean
21 22 23 24 |
# File 'lib/taskwarrior-web/model/annotation.rb', line 21 def is_valid? @_errors << 'You must provide a description' if self.description.blank? @_errors.empty? end |