C0 code coverage information
Generated on Tue May 30 23:34:44 CEST 2006 with rcov 0.5.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 Sidebars::Plugin < ApplicationController
2 uses_component_template_root
3 include ApplicationHelper
4
5
6 # The name that needs to be used when refering to the plugin's
7 # controller in render statements
8 def self.component_name
9 if (self.to_s=~/::([a-zA-Z]+)Controller/)
10 "plugins/sidebars/#{$1}".downcase
11 else
12 raise "I don't know who I am: #{self.to_s}"
13 end
14 end
15
16 # The name that's stored in the DB. This is the final chunk of the
17 # controller name, like 'xml' or 'flickr'.
18 def self.short_name
19 component_name.split(%r{/}).last
20 end
21
22 # The name that shows up in the UI
23 def self.display_name
24 # This is the default, but it's best to override it
25 short_name
26 end
27
28 def self.description
29 short_name
30 end
31
32 def self.default_config
33 {}
34 end
35
36 def index
37 @sidebar=params['sidebar']
38 @sb_config = @sidebar.active_config
39 if(not @sb_config or @sb_config.size == 0)
40 @sb_config = (self.class.default_config)
41 end
42 content
43 render :action=>'content' unless performed?
44 end
45
46 def configure_wrapper
47 @sidebar=params['sidebar']
48 @sidebar.staged_config ||= (self.class.default_config)
49 configure
50 render :action=>'configure' unless performed?
51 end
52
53 # This controller is used on to actually display sidebar items.
54 def content
55 end
56
57 # This controller is used to configure the sidebar from /admin/sidebar
58 def configure
59 render_text ''
60 end
61
62 def save_config
63 render_text ''
64 end
65
66 private
67 def sb_config(key)
68 @sidebar.active_config[key.to_s]
69 end
70
71 # Horrid hack to make check_cache happy
72 def controller
73 self
74 end
75 end
76
77 module Sidebars
78 class SidebarController < ApplicationController
79
80 uses_component_template_root
81
82 def display_plugins
83 @sidebars=self.class.enabled_sidebars
84 render :layout => false
85 end
86
87 def self.enabled_sidebars
88 available=available_sidebars.inject({}) { |h,i| h[i.short_name]=i; h}
89
90 enabled=Sidebar.find_all_visible.select do |sidebar|
91 sidebar.controller and available[sidebar.controller]
92 end
93 end
94
95 def self.available_sidebars
96 objects=[]
97 ObjectSpace.each_object(Class) do |o|
98 if Plugin > o
99 objects.push o
100 end
101 end
102
103 objects
104 end
105 end
106 end
107
108 Dir["#{RAILS_ROOT}/components/plugins/sidebars/[_a-z]*.rb"].each do |f|
109 require_dependency f
110 end
Generated using the rcov code coverage analysis tool for Ruby version 0.5.0.