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 'rexml/document'
Calls
1 Object#require at vendor/rails/activesupport/lib/active_support/dependencies.rb:213
3
4 # Example:
5 #
6 # upcoming = Upcoming.new('http://upcoming.org/syndicate/my_events/<your_user_id>')
7 # upcoming.events.each do |event|
8 # puts "#{event.title} @ #{event.timespan} #{event.link} : #{event.description}"
9 # end
10 #
11
12 class Upcoming
Calls
1 Class#inherited at vendor/rails/activesupport/lib/active_support/class_inheritable_attributes.rb:108
13 include REXML
14
15 def choose(num)
Calls
1 #<Class:Object>#method_added at vendor/rails/actionpack/lib/action_view/vendor/builder/blankslate.rb:47
16 return events unless events.size > num
17 bag = []
18 set = events.dup
19 (0..num-1).each {|x| bag << set.delete_at(set.size)}
20 bag
21 end
22
23 attr_accessor :events, :link, :title, :description, :url
Calls
10 #<Class:Object>#method_added at vendor/rails/actionpack/lib/action_view/vendor/builder/blankslate.rb:47
24
25 # This object holds given information for an Event
26 class Event < Struct.new(:link, :title, :description)
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
27 def to_s; title end
Calls
1 #<Class:Object>#method_added at vendor/rails/actionpack/lib/action_view/vendor/builder/blankslate.rb:47
28
29 def timespan
Calls
1 #<Class:Object>#method_added at vendor/rails/actionpack/lib/action_view/vendor/builder/blankslate.rb:47
30 description.split(':')[0]
31 end
32
33 def info
Calls
1 #<Class:Object>#method_added at vendor/rails/actionpack/lib/action_view/vendor/builder/blankslate.rb:47
34 description.split(':')[1]
35 end
36 end
37
38 # Pass the url to the RSS feed you would like to keep tabs on
39 # by default this will request the rss from the server right away and
40 # fill the tasks array
41 def initialize(url, refresh = true)
Calls
1 #<Class:Object>#method_added at vendor/rails/actionpack/lib/action_view/vendor/builder/blankslate.rb:47
42 self.events = []
43 self.url = url
44 self.refresh if refresh
45 end
46
47 # This method lets you refresh the tasks int the tasks array
48 # useful if you keep the object cached in memory and
49 def refresh
Calls
1 #<Class:Object>#method_added at vendor/rails/actionpack/lib/action_view/vendor/builder/blankslate.rb:47
50 open(@url) do |http|
51 parse(http.read)
52 end
53 end
54
55 private
56
57 def parse(body)
Calls
1 #<Class:Object>#method_added at vendor/rails/actionpack/lib/action_view/vendor/builder/blankslate.rb:47
58
59 xml = Document.new(body)
60
61 self.events = []
62 self.link = XPath.match(xml, "//channel/link/text()").to_s
63 self.title = XPath.match(xml, "//channel/title/text()").to_s
64 self.description = XPath.match(xml, "//channel/description/text()").to_s
65
66 XPath.each(xml, "//item/") do |elem|
67
68 event = Event.new
69 event.title = XPath.match(elem, "title/text()").to_s
70 event.link = XPath.match(elem, "link/text()").to_s
71 event.description = XPath.match(elem, "description/text()").to_s
72 event.inspect
73 events << event
74 end
75 end
76 end
77
78
Generated using the rcov code coverage analysis tool for Ruby version 0.6.0.