C0 code coverage information
Generated on Tue May 30 23:34:43 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 # The methods added to this helper will be available to all templates in the application.
2 require 'digest/sha1'
3
4 module ApplicationHelper
5
6 def categorylist()
7 categories = Category.find_all_with_article_counters
8 render_partial("shared/categories", categories)
9 end
10
11 def flickrlist(url)
12 begin
13 render_partial("shared/flickr", check_cache(Flickr, url))
14 rescue
15 end
16 end
17
18 def tadalist(url)
19 begin
20 render_partial("shared/tada", check_cache(Tada, url))
21 rescue
22 end
23 end
24
25 def deliciouslist(url)
26 begin
27 render_partial("shared/delicious", check_cache(Delicious, url))
28 rescue
29 end
30 end
31
32 def fortythreelist(url)
33 begin
34 render_partial("shared/fortythree", check_cache(Fortythree, url))
35 rescue
36 end
37 end
38
39 def upcominglist(url)
40 begin
41 render_partial("shared/upcoming", check_cache(Upcoming, url))
42 rescue
43 end
44 end
45
46 def server_url_for(options = {})
47 url_for options.update(:only_path => false)
48 end
49
50 def strip_html(text)
51 attribute_key = /[\w:_-]+/
52 attribute_value = /(?:[A-Za-z0-9]+|(?:'[^']*?'|"[^"]*?"))/
53 attribute = /(?:#{attribute_key}(?:\s*=\s*#{attribute_value})?)/
54 attributes = /(?:#{attribute}(?:\s+#{attribute})*)/
55 tag_key = attribute_key
56 tag = %r{<[!/?\[]?(?:#{tag_key}|--)(?:\s+#{attributes})?\s*(?:[!/?\]]+|--)?>}
57 text.gsub(tag, '').gsub(/\s+/, ' ').strip
58 end
59
60 def config_value(name)
61 config[name]
62 end
63
64 def article_link(title, article,anchor=nil)
65 link_to title, article_url(article,true,anchor)
66 end
67
68 def page_link(title, page,anchor=nil)
69 link_to title, page_url(page,true,anchor)
70 end
71
72 def comment_url_link(title, comment)
73 link_to title, comment_url(comment)
74 end
75
76 def article_url(article, only_path = true, anchor = nil)
77 url_for :only_path => only_path, :controller=>"/articles", :action =>"permalink", :year => article.created_at.year, :month => sprintf("%.2d", article.created_at.month), :day => sprintf("%.2d", article.created_at.day), :title => article.permalink, :anchor => anchor
78 end
79
80 def page_url(page, only_path = true, anchor = nil)
81 url_for :only_path => only_path, :controller => "/articles", :action => "view_page", :name => page.name, :anchor => anchor
82 end
83
84 def comment_url(comment, only_path = true)
85 article = comment.article
86 url_for :only_path => only_path, :controller=>"/articles", :action =>"permalink", :year => article.created_at.year, :month => sprintf("%.2d", article.created_at.month), :day => sprintf("%.2d", article.created_at.day), :title => article.permalink, :anchor=> "comment-#{comment.id}"
87 end
88
89 def trackback_url(trackback, only_path = true)
90 article = trackback.article
91 url_for :only_path => only_path, :controller=>"/articles", :action =>"permalink", :year => article.created_at.year, :month => sprintf("%.2d", article.created_at.month), :day => sprintf("%.2d", article.created_at.day), :title => article.permalink, :anchor=> "trackback-#{trackback.id}"
92 end
93
94 def responses(collection, word)
95 case collection.size
96 when 0
97 "no #{word}s"
98 when 1
99 "1 #{word}"
100 else
101 "#{collection.size} #{word}s"
102 end
103 end
104
105 def comments_link(article)
106 article_link responses(article.comments, "comment"), article, 'comments'
107 end
108
109 def trackbacks_link(article)
110 article_link responses(article.trackbacks, "trackback"), article, 'trackbacks'
111 end
112
113 def check_cache(aggregator, url)
114 hash = "#{aggregator.to_s}_#{Digest::SHA1.hexdigest(url)}".to_sym
115 controller.cache[hash] ||= aggregator.new(url)
116 end
117
118 def js_distance_of_time_in_words_to_now(date)
119 time = date.utc.strftime("%a, %d %b %Y %H:%M:%S GMT")
120 "<span class=\"typo_date\" title=\"#{time}\">#{time}</span>"
121 end
122
123 def render_sidebar(sidebar)
124 begin
125 render_component :layout => false, :controller => sidebar.sidebar_controller.component_name, :action=>'index', :params => {:sidebar => sidebar }
126 rescue => e
127 content_tag :p, e.message, :class => 'error'
128 end
129 end
130
131 def meta_tag(name, value)
132 tag :meta, :name => name, :content => value unless value.blank?
133 end
134
135 def date(date)
136 "<span class=\"typo_date\">#{date.utc.strftime("%d. %b")}</span>"
137 end
138
139 def render_theme(options)
140 options[:controller]=Themes::ThemeController.active_theme_name
141 render_component(options)
142 end
143
144 def toggle_effect(domid, true_effect, true_opts, false_effect, false_opts)
145 "$('#{domid}').style.display == 'none' ? new #{false_effect}('#{domid}', {#{false_opts}}) : new #{true_effect}('#{domid}', {#{true_opts}}); return false;"
146 end
147 end
Generated using the rcov code coverage analysis tool for Ruby version 0.5.0.