Class: RememberTheRuby::Task

Inherits:
Entity
  • Object
show all
Defined in:
lib/remember-the-ruby/task.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Entity

#[], #[]=, #hydrate_from, #initialize, list_from_elements, #method_missing, #original_lookup, #regular_reader, #regular_writer

Constructor Details

This class inherits a constructor from RememberTheRuby::Entity

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class RememberTheRuby::Entity

Class Method Details

.from_element(transport, element) ⇒ Object



4
5
6
7
8
9
10
# File 'lib/remember-the-ruby/task.rb', line 4

def self.from_element(transport, element)
  task = super
  task["occurrences"] = TaskOccurrence.list_from_elements(transport, element, 'task')
  task["next"] = task["occurrences"].sorted_by(:due).first
  task["tags"] = Tag.list_from_elements(transport, element, 'tags/tag')
  task
end

Instance Method Details

#save!(params = {}) ⇒ Object



12
13
14
15
16
17
# File 'lib/remember-the-ruby/task.rb', line 12

def save!(params={})
  hydrate_from do
    @transport.tasks.add(:name => self[:name], :parse => params[:parse])
  end
  # TODO: apply tags
end