C0 code coverage information
Generated on Fri Aug 25 11:26:28 PDT 2006 with rcov 0.7.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 class MediaLink
2 attr_accessor :artist, :title, :media_type
3 attr_reader :url
4
5 MP3 = 2
6 VIDEO = 3
7 STREAM = 4
8 OTHER = 1
9
10 def initialize(url, artist, title, media_type)
11 @url, @artist, @title, @media_type = fix_url(url), artist, title, media_type.to_i
12 end
13
14 def initialize(hash = {})
15 @url, @artist, @title, @media_type = fix_url(hash[:url]), hash[:artist], hash[:title], hash[:media_type].to_i
16 end
17
18 def url=(url)
19 @url = fix_url(url)
20 end
21
22 def media_type_to_s
23 if @media_type == MP3
24 "MP3"
25 elsif @media_type == VIDEO
26 "Video"
27 elsif @media_type == STREAM
28 "Stream"
29 else
30 "Other"
31 end
32 end
33
34
35 private
36
37 def fix_url(url)
38 unless url
39 return nil
40 end
41 unless url.include? 'http://' or url.include? 'https://'
42 fixed_url = 'http://' + url
43 else
44 fixed_url = url
45 end
46 fixed_url
47 end
48
49 end
Generated using the rcov code coverage analysis tool for Ruby version 0.7.0.