C0 code coverage information
Generated on Sun Jun 11 23:15:13 CEST 2006 with rcov 0.6.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.
1 require 'open-uri'
Calls
1 Object#require at vendor/rails/activesupport/lib/active_support/dependencies.rb:213
2 require 'time'
Calls
1 Object#require at vendor/rails/activesupport/lib/active_support/dependencies.rb:213
3 require 'rexml/document'
Calls
1 Object#require at vendor/rails/activesupport/lib/active_support/dependencies.rb:213
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
Calls
1 Class#inherited at vendor/rails/activesupport/lib/active_support/class_inheritable_attributes.rb:108
13 include REXML
14
15 attr_accessor :url, :tasks, :link, :title, :description
Calls
10 #<Class:Object>#method_added at vendor/rails/actionpack/lib/action_view/vendor/builder/blankslate.rb:47
16
17 # This object holds given information of a task
18 class TaskItem < Struct.new(:link, :title, :date, :status)
Calls
8 #<Class:Object>#method_added at vendor/rails/actionpack/lib/action_view/vendor/builder/blankslate.rb:47
2 Class#inherited at vendor/rails/activesupport/lib/active_support/class_inheritable_attributes.rb:108
19 def to_s; title end
Calls
1 #<Class:Object>#method_added at vendor/rails/actionpack/lib/action_view/vendor/builder/blankslate.rb:47
20 def date=(value); super(Time.parse(value)) end
Calls
1 #<Class:Object>#method_added at vendor/rails/actionpack/lib/action_view/vendor/builder/blankslate.rb:47
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)
Calls
1 #<Class:Object>#method_added at vendor/rails/actionpack/lib/action_view/vendor/builder/blankslate.rb:47
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
Calls
1 #<Class:Object>#method_added at vendor/rails/actionpack/lib/action_view/vendor/builder/blankslate.rb:47
35 open(@url) do |http|
36 parse(http.read)
37 end
38 end
39
40 private
41
42 def parse(body)
Calls
1 #<Class:Object>#method_added at vendor/rails/actionpack/lib/action_view/vendor/builder/blankslate.rb:47
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.6.0.