C0 code coverage information
Generated on Fri Aug 25 10:11:29 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 ArticleCacheController < ApplicationController
2 #wsdl_service_name 'ArticleCache'
3 #web_service_scaffold :invoke
4
5 skip_before_filter :login_required
6
7 def get
8 cut_off = Time.now - 21600 # 6 hours ago; lets try and cache some recent stuff
9 @rv = %w(page/*.html page/news/page*.html) # default set
10
11 ## we use ArticleCache here because we can be indiscriminate as to the model - we don't care about all the added sti support Articles has
12 list = ArticleCache.find_by_time(cut_off)
13
14 if !list.nil?
15 list.each do |e|
16 @rv << 'article/' + e.article_type.to_s.underscore + '/' + e.id.to_s + '*'
17 @rv << 'page/' + e.article_type.to_s.underscore + '/' + e.id.to_s + '*'
18 @rv << 'page/' + e.article_type.to_s.underscore + '/' + make_web_safe(e.title) + '.html'
19 end
20 end
21
22 respond_to do |via|
23 via.html { redirect_to :controller => 'articles', :action => 'list' }
24 via.xml { render }
25 end
26
27 end
28
29 protected
30
31 def make_web_safe(input)
32
33 result = input
34
35 # replace quotes by nothing
36 result.gsub!(/['"]/, '')
37
38 # strip all non word chars
39 result.gsub!(/(\s|\/|\.{1,3})|(&)|([\W])/) do |m|
40 if $1
41 "_"
42 elsif $2
43 "_and_"
44 else
45 ""
46 end
47 end
48
49 # replace all white space sections with an underscore
50 result.gsub!(/\ +/, '_')
51
52 # trim dashes
53 #result.gsub!(/(-)$/, '')
54 #result.gsub!(/^(-)/, '')
55
56 result
57 end
58
59 end
Generated using the rcov code coverage analysis tool for Ruby version 0.7.0.