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 class Delicious
Calls
1 Class#inherited at vendor/rails/activesupport/lib/active_support/class_inheritable_attributes.rb:108
6 include REXML
7
8 attr_accessor :url, :items, :link, :title
Calls
8 #<Class:Object>#method_added at vendor/rails/actionpack/lib/action_view/vendor/builder/blankslate.rb:47
9
10 # This object holds given information of an item
11 class DeliciousItem < Struct.new(:link, :title, :date)
Calls
6 #<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
12 def to_s; title end
Calls
1 #<Class:Object>#method_added at vendor/rails/actionpack/lib/action_view/vendor/builder/blankslate.rb:47
13 end
14
15 # Pass the url to the RSS feed you would like to keep tabs on
16 # by default this will request the rss from the server right away and
17 # fill the items array
18 def initialize(url, refresh = true)
Calls
1 #<Class:Object>#method_added at vendor/rails/actionpack/lib/action_view/vendor/builder/blankslate.rb:47
19 self.items = []
20 self.url = url
21 self.refresh if refresh
22 end
23
24 # This method lets you refresh the items in the items array
25 # useful if you keep the object cached in memory and
26 def refresh
Calls
1 #<Class:Object>#method_added at vendor/rails/actionpack/lib/action_view/vendor/builder/blankslate.rb:47
27 open(@url) do |http|
28 parse(http.read)
29 end
30 end
31
32 private
33
34 def parse(body)
Calls
1 #<Class:Object>#method_added at vendor/rails/actionpack/lib/action_view/vendor/builder/blankslate.rb:47
35
36 xml = Document.new(body)
37
38 self.items = []
39 self.link = XPath.match(xml, "//channel/link/text()").to_s
40 self.title = XPath.match(xml, "//channel/title/text()").to_s
41
42 XPath.each(xml, "//item/") do |elem|
43
44 item = DeliciousItem.new
45 item.title = XPath.match(elem, "title/text()").to_s
46 item.link = XPath.match(elem, "link/text()").to_s
47 item.date = Time.mktime(*ParseDate.parsedate(XPath.match(elem, "dc:date/text()").to_s))
48 items << item
49 end
50
51 self.items = items.sort_by { |item| item.date }.reverse
52 end
53 end
Generated using the rcov code coverage analysis tool for Ruby version 0.6.0.