Class: RememberTheRuby::Tag

Inherits:
Entity
  • Object
show all
Defined in:
lib/remember-the-ruby/tag.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
# File 'lib/remember-the-ruby/tag.rb', line 4

def self.from_element(transport, element)
  tag = super
  tag['name'] = element.text
  tag
end

Instance Method Details

#tasksObject



14
15
16
17
18
# File 'lib/remember-the-ruby/tag.rb', line 14

def tasks
  tasks = @transport.tasks.get_list(:filter => "tag:#{self["name"]}")
  # TODO: add default tag to the tasks list
  tasks
end

#to_sObject



10
11
12
# File 'lib/remember-the-ruby/tag.rb', line 10

def to_s
  self['name']
end