C0 code coverage information

Generated on Tue May 30 23:34:43 CEST 2006 with rcov 0.5.0


Code reported as executed by Ruby looks like this...
and this: this line is also marked as covered.
Lines considered as run by rcov, but not reported by Ruby, look like this,
and this: these lines were inferred by rcov (using simple heuristics).
Finally, here's a line marked as not executed.
Name Total lines Lines of code Total coverage Code coverage
app/models/aggregations/tada.rb 75 45
45.3% 
31.1% 
 1 require 'open-uri'
 2 require 'time'
 3 require 'rexml/document'
 4 
 5 # Example:
 6 # 
 7 # tada = Tada.new('http://<nick>.tadalist.com/lists/feed/<id>?token=<token>')
 8 # tada.tasks.each do |task|
 9 #   puts "#{task.title} @ #{task.link} updated at #{task.date}"
10 # end
11 #
12 class Tada
13   include REXML
14 
15   attr_accessor :url, :tasks, :link, :title, :description
16     
17   # This object holds given information of a task
18   class TaskItem < Struct.new(:link, :title, :date, :status)
19     def to_s; title end          
20     def date=(value); super(Time.parse(value)) end
21   end
22     
23   # Pass the url to the RSS feed you would like to keep tabs on
24   # by default this will request the rss from the server right away and 
25   # fill the tasks array  def initialize(url, refresh = true)
26   def initialize(url, refresh = true)
27     self.tasks  = []
28     self.url    = url
29     self.refresh if refresh
30   end
31   
32   # This method lets you refresh the tasks int the tasks array
33   # useful if you keep the object cached in memory and 
34   def refresh
35     open(@url) do |http|
36       parse(http.read)
37     end
38   end
39   
40 private
41 
42   def parse(body)
43   
44     xml = Document.new(body)
45   
46     self.tasks        = []    
47     self.link         = XPath.match(xml, "//channel/link/text()")
48     self.title        = XPath.match(xml, "//channel/title/text()")
49     self.description  = XPath.match(xml, "//channel/description/text()")
50           
51     XPath.each(xml, "//item/") do |elem| 
52     
53       title = XPath.match(elem, "title/text()").to_s
54 
55        # extract the status from the title
56        status = if title =~ /^(.+): (.+)$/
57          title = $2
58          $1.downcase.intern
59        else
60          :unknown
61        end
62 
63       task = TaskItem.new
64       task.title = title
65       task.status = status
66                   
67       task.date  = XPath.match(elem, "pubDate/text()").to_s
68       task.link  = XPath.match(elem, "link/text()").to_s
69       
70       tasks << task
71     end
72 
73     self.tasks = tasks.sort_by { |task| task.status.to_s }
74   end
75 end

Generated using the rcov code coverage analysis tool for Ruby version 0.5.0.

Valid XHTML 1.0! Valid CSS!