C0 code coverage information

Generated on Sat Feb 02 17:44:27 +0100 2008 with rcov 0.8.1.2


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/ramaze/helper/partial.rb 80 36
52.5% 
16.7% 
 1 #          Copyright (c) 2008 Michael Fellinger m.fellinger@gmail.com
 2 # All files in this distribution are subject to the terms of the Ruby license.
 3 
 4 module Ramaze
 5 
 6   # = PartialHelper
 7   #
 8   # === Example Usage
 9   #
10   #   class MyController
11   #     def index
12   #     end
13   #     def list
14   #       plain = request['plain']
15   #       "Hello World from List!  Plain List == #{plain}"
16   #     end
17   #   end
18   #
19   #
20   #   <html>
21   #     <head><title>Partial Render Index</title></head>
22   #     <body>
23   #       #{render_partial(Rs(:list), 'plain' => true)}
24   #     </body>
25   #   </html>
26 
27   module PartialHelper
28 
29     private
30     module_function
31 
32     # Renders a url 'inline'.
33     #
34     # url:      normal URL, like you'd use for redirecting.
35     # options:  optional, will be used as request parameters.
36 
37     def render_partial(url, options = {})
38       saved = {}
39       options.keys.each {|x| saved[x] = Request.current.params[x] }
40       saved_action = Action.current
41 
42       Request.current.params.update(options)
43 
44       Controller.handle(url)
45     ensure
46       Thread.current[:action] = saved_action
47       options.keys.each {|x| Request.current.params[x] = saved[x] }
48     end
49 
50     # Render the template file in template_root of the
51     # current controller.
52 
53     def render_template(file, locals = {})
54       current = Action.current
55       options = { :controller => current.controller,
56                   :instance => current.instance.dup }
57 
58       roots = [options[:controller].template_root].flatten
59 
60       if (files = Dir["{#{roots.join(',')}}"/"{#{file},#{file}.*}"]).any?
61         options[:template] = files.first
62       else
63         Inform.warn "render_template: #{filename} does not exist"
64         return ''
65       end
66 
67       # use method_missing to provide access to locals, if any exist
68       options[:instance].meta_def(:method_missing) { |sym, *args|
69         return locals[sym] if locals.key?(sym)
70         super
71       } if locals.any?
72 
73       options[:binding]  = options[:instance].instance_eval{ binding }
74 
75       Ramaze::Action(options).render
76     ensure
77       Thread.current[:action] = current
78     end
79   end
80 end

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

Valid XHTML 1.0! Valid CSS!