C0 code coverage information

Generated on Sat May 27 21:23:35 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/fortythree.rb 62 36
54.8% 
38.9% 
 1 require 'open-uri'
 2 require 'time'
 3 require 'rexml/document'
 4 
 5 # Example:
 6 # 
 7 # fortythree = Fortythree.new('http://www.43things.com/rss/uber/author?username=<user>')
 8 # fortythree.things.each do |thing|
 9 #   puts "#{thing.title} @ #{thing.link} updated at #{thing.date}"
10 # end
11 #
12 class Fortythree
13   include REXML
14 
15   attr_accessor :url, :things, :link, :title, :description
16     
17   # This object holds given information of a thing
18   class ThingItem < Struct.new(:link, :title, :date)
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.things  = []
28     self.url    = url
29     self.refresh if refresh
30   end
31   
32   # This method lets you refresh the things into the things 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.things        = []    
47     self.link         = XPath.match(xml, "//channel/link/text()").to_s
48     self.title        = XPath.match(xml, "//channel/title/text()").to_s
49     self.description  = XPath.match(xml, "//channel/description/text()").to_s
50           
51     XPath.each(xml, "//item/") do |elem| 
52     
53       thing = ThingItem.new
54       thing.title = XPath.match(elem, "title/text()").to_s
55                   
56       thing.date  = XPath.match(elem, "pubDate/text()").to_s
57       thing.link  = XPath.match(elem, "link/text()").to_s
58       
59       things << thing
60     end
61   end
62 end

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

Valid XHTML 1.0! Valid CSS!