C0 code coverage information

Generated on Fri Jul 11 15:55:32 -0700 2008 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.
Name Total lines Lines of code Total coverage Code coverage
lib/openid/yadis/xri.rb 90 65
96.7% 
95.4% 
 1 require 'openid/yadis/xrds'
 2 require 'openid/fetchers'
 3 
 4 module OpenID
 5   module Yadis
 6     module XRI
 7 
 8       # The '(' is for cross-reference authorities, and hopefully has a
 9       # matching ')' somewhere.
10       XRI_AUTHORITIES = ["!", "=", "@", "+", "$", "("]
11 
12       def self.identifier_scheme(identifier)
13         if (!identifier.nil? and
14             identifier.length > 0 and
15             (identifier.match('^xri://') or
16              XRI_AUTHORITIES.member?(identifier[0].chr)))
17           return :xri
18         else
19           return :uri
20         end
21       end
22 
23       # Transform an XRI reference to an IRI reference.  Note this is
24       # not not idempotent, so do not apply this to an identifier more
25       # than once.  XRI Syntax section 2.3.1
26       def self.to_iri_normal(xri)
27         iri = xri.dup
28         iri.insert(0, 'xri://') if not iri.match('^xri://')
29         return escape_for_iri(iri)
30       end
31 
32       # Note this is not not idempotent, so do not apply this more than
33       # once.  XRI Syntax section 2.3.2
34       def self.escape_for_iri(xri)
35         esc = xri.dup
36         # encode all %
37         esc.gsub!(/%/, '%25')
38         esc.gsub!(/\((.*?)\)/) { |xref_match|
39           xref_match.gsub(/[\/\?\#]/) { |char_match|
40             CGI::escape(char_match)
41           }
42         }
43         return esc
44       end
45 
46       # Transform an XRI reference to a URI reference.  Note this is not
47       # not idempotent, so do not apply this to an identifier more than
48       # once.  XRI Syntax section 2.3.1
49       def self.to_uri_normal(xri)
50         return iri_to_uri(to_iri_normal(xri))
51       end
52 
53       # RFC 3987 section 3.1
54       def self.iri_to_uri(iri)
55         uri = iri.dup
56         # for char in ucschar or iprivate
57         # convert each char to %HH%HH%HH (as many %HH as octets)
58         return uri
59       end
60 
61       def self.provider_is_authoritative(provider_id, canonical_id)
62         lastbang = canonical_id.rindex('!')
63         return false unless lastbang
64         parent = canonical_id[0...lastbang]
65         return parent == provider_id
66       end
67 
68       def self.root_authority(xri)
69         xri = xri[6..-1] if xri.index('xri://') == 0
70         authority = xri.split('/', 2)[0]
71         if authority[0].chr == '('
72           root = authority[0...authority.index(')')+1]
73         elsif XRI_AUTHORITIES.member?(authority[0].chr)
74           root = authority[0].chr
75         else
76           root = authority.split(/[!*]/)[0]
77         end
78 
79         self.make_xri(root)
80       end
81 
82       def self.make_xri(xri)
83         if xri.index('xri://') != 0
84           xri = 'xri://' + xri
85         end
86         return xri
87       end
88     end
89   end
90 end

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

Valid XHTML 1.0! Valid CSS!