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 # 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
Calls
1 Class#inherited at vendor/rails/activesupport/lib/active_support/class_inheritable_attributes.rb:108
13 include REXML
14
15 attr_accessor :url, :things, :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 thing
18 class ThingItem < 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
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.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
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.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.6.0.