C0 code coverage information
Generated on Sun Jun 11 23:15:14 CEST 2006 with rcov 0.6.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 require 'uri'
Calls
1 Object#require at vendor/rails/activesupport/lib/active_support/dependencies.rb:213
2 require 'net/http'
Calls
1 Object#require at vendor/rails/activesupport/lib/active_support/dependencies.rb:213
3 require 'md5'
Calls
1 Object#require at vendor/rails/activesupport/lib/active_support/dependencies.rb:213
4
5 class Article < ActiveRecord::Base
Calls
1 #<Class:ActiveRecord::Base>#inherited at vendor/rails/activerecord/lib/active_record/base.rb:246
6 has_many :pings, :dependent => true, :order => "created_at ASC"
Calls
1 #<Class:ActiveRecord::Base>#has_many at (eval):4
7 has_many :comments, :dependent => true, :order => "created_at ASC"
Calls
1 #<Class:ActiveRecord::Base>#has_many at (eval):4
8 has_many :trackbacks, :dependent => true, :order => "created_at ASC"
Calls
1 #<Class:ActiveRecord::Base>#has_many at (eval):4
9
10 has_and_belongs_to_many :categories
Calls
1 #<Class:ActiveRecord::Base>#has_and_belongs_to_many at (eval):4
11 belongs_to :user
Calls
1 #<Class:ActiveRecord::Base>#belongs_to at (eval):4
12
13 def stripped_title
Calls
1 #<Class:Object>#method_added at vendor/rails/actionpack/lib/action_view/vendor/builder/blankslate.rb:47
Called by
14 app/apis/meta_weblog_service.rb:198 in 'MetaWeblogService#article_url'
14 self.title.to_url
Calls
14 String#to_url at lib/transforms.rb:18
14 Article#title at (eval):1
15 end
16
17 def send_pings(articleurl, urllist)
Calls
1 #<Class:Object>#method_added at vendor/rails/actionpack/lib/action_view/vendor/builder/blankslate.rb:47
Called by
1 app/apis/meta_weblog_service.rb:114 in 'MetaWeblogService#newPost'
1 app/apis/meta_weblog_service.rb:149 in 'MetaWeblogService#editPost'
18
19 # we need to transform the body now
20 # because we need to sent out an except based on the html representation
21 transform_body
Calls
2 Article#transform_body at app/models/article.rb:92
22
23 urllist.to_a.each do |url|
24 begin
25 unless pings.collect { |p| p.url }.include?(url.strip)
26 ping = pings.build("url" => url)
27
28 ping.send_ping(articleurl)
29 ping.save
30 end
31
32 rescue
33 # in case the remote server doesn't respond or gives an error,
34 # we should throw an xmlrpc error here.
35 end
36 end
37 end
38
39 # Count articles on a certain date
40 def self.count_by_date(year, month = nil, day = nil, limit = nil)
41 from, to = self.time_delta(year, month, day)
42 Article.count(["articles.created_at BETWEEN ? AND ? AND articles.published != 0", from, to])
43 end
44
45 # Find all articles on a certain date
46 def self.find_all_by_date(year, month = nil, day = nil)
Called by
1 app/controllers/articles_controller.rb:43 in 'ArticlesController#find_by_date'
47 from, to = self.time_delta(year, month, day)
Calls
1 #<Class:Article>#time_delta at app/models/article.rb:97
48 Article.find(:all, :conditions => ["articles.created_at BETWEEN ? AND ? AND articles.published != 0", from, to], :order => 'articles.created_at DESC', :include => [:categories, :trackbacks, :comments])
Calls
1 #<Class:ActiveRecord::Base>#find at vendor/rails/activerecord/lib/active_record/base.rb:378
49 end
50
51 # Find one article on a certain date
52 def self.find_by_date(year, month, day)
53 find_all_by_date(year, month, day).first
54 end
55
56 # Finds one article which was posted on a certain date and matches the supplied dashed-title
57 def self.find_by_permalink(year, month, day, title)
Called by
1 app/controllers/articles_controller.rb:31 in 'ArticlesController#permalink'
58 from, to = self.time_delta(year, month, day)
Calls
1 #<Class:Article>#time_delta at app/models/article.rb:97
59 find(:first, :conditions => [ %{
Calls
1 #<Class:ActiveRecord::Base>#find at vendor/rails/activerecord/lib/active_record/base.rb:378
60 permalink = ?
61 AND articles.created_at BETWEEN ? AND ?
62 AND articles.published != 0
63 }, title, from, to ])
64 end
65
66 # Fulltext searches the body of published articles
67 def self.search(query)
68 if !query.to_s.strip.empty?
69 tokens = query.split.collect {|c| "%#{c.downcase}%"}
70 find_by_sql(["SELECT * from articles WHERE articles.published != 0 AND #{ (["(LOWER(body) LIKE ? OR LOWER(extended) LIKE ? OR LOWER(title) LIKE ?)"] * tokens.size).join(" AND ") } AND published != 0 ORDER by created_at DESC", *tokens.collect { |token| [token] * 3 }.flatten])
71 else
72 []
73 end
74 end
75
76 # Get the full html body
77 def full_html
Calls
1 #<Class:Object>#method_added at vendor/rails/actionpack/lib/action_view/vendor/builder/blankslate.rb:47
Called by
3 app/views/xml/atom.rxml:28 in 'ActionView::Base::CompiledTemplates#_run_xml_xml_atom'
1 app/views/xml/articlerss.rxml:22 in 'ActionView::Base::CompiledTemplates#_run_xml_xml_articlerss'
1 app/views/articles/read.rhtml:22 in 'ActionView::Base::CompiledTemplates#_run_html_articles_read'
78 "#{body_html}\n\n#{extended_html}"
Calls
5 Article#extended_html at (eval):1
5 Article#body_html at (eval):1
79 end
80
81 protected
82
83 before_save :set_defaults, :transform_body
Calls
1 #<Class:ActiveRecord::Base>#before_save at (eval):1
84
85 def set_defaults
Calls
1 #<Class:Object>#method_added at vendor/rails/actionpack/lib/action_view/vendor/builder/blankslate.rb:47
86 self.published ||= 1
87 self.text_filter = config['text_filter'] if self.text_filter.blank?
88 self.permalink = self.stripped_title if self.attributes.include?("permalink") and self.permalink.blank?
89 self.guid = Digest::MD5.new(self.body.to_s+self.extended.to_s+self.title.to_s+self.permalink.to_s+self.author.to_s+Time.now.to_f.to_s).to_s if self.guid.blank?
90 end
91
92 def transform_body
Calls
1 #<Class:Object>#method_added at vendor/rails/actionpack/lib/action_view/vendor/builder/blankslate.rb:47
Called by
2 app/models/article.rb:21 in 'Article#send_pings'
93 self.body_html = HtmlEngine.transform(body, self.text_filter)
Calls
2 #<Class:HtmlEngine>#transform at lib/html_engine.rb:3
2 Article#text_filter at (eval):1
2 ActiveRecord::Base#method_missing at vendor/rails/activerecord/lib/active_record/base.rb:1479
2 Article#body at (eval):1
1 Module#const_missing at vendor/rails/activesupport/lib/active_support/dependencies.rb:187
94 self.extended_html = HtmlEngine.transform(extended, self.text_filter)
Calls
2 Article#text_filter at (eval):1
2 Article#extended at (eval):1
2 ActiveRecord::Base#method_missing at vendor/rails/activerecord/lib/active_record/base.rb:1479
2 #<Class:HtmlEngine>#transform at lib/html_engine.rb:3
95 end
96
97 def self.time_delta(year, month = nil, day = nil)
Called by
1 app/models/article.rb:58 in '#<Class:Article>#find_by_permalink'
1 app/models/article.rb:47 in '#<Class:Article>#find_all_by_date'
98 from = Time.mktime(year, month || 1, day || 1)
99
100 to = from + 1.year
Calls
2 ActiveSupport::CoreExtensions::Numeric::Time#year at vendor/rails/activesupport/lib/active_support/core_ext/numeric/time.rb:36
101 to = from + 1.month unless month.blank?
Calls
2 String#blank? at vendor/rails/activesupport/lib/active_support/core_ext/blank.rb:29
2 ActiveSupport::CoreExtensions::Numeric::Time#month at vendor/rails/activesupport/lib/active_support/core_ext/numeric/time.rb:31
102 to = from + 1.day unless day.blank?
Calls
2 String#blank? at vendor/rails/activesupport/lib/active_support/core_ext/blank.rb:29
2 ActiveSupport::CoreExtensions::Numeric::Time#day at vendor/rails/activesupport/lib/active_support/core_ext/numeric/time.rb:16
103 to = to.tomorrow unless month.blank?
Calls
2 String#blank? at vendor/rails/activesupport/lib/active_support/core_ext/blank.rb:29
2 ActiveSupport::CoreExtensions::Time::Calculations#tomorrow at vendor/rails/activesupport/lib/active_support/core_ext/time/calculations.rb:168
104 return [from, to]
105 end
106
107 validates_uniqueness_of :guid
Calls
1 ActiveRecord::Validations::ClassMethods#validates_uniqueness_of at vendor/rails/activerecord/lib/active_record/validations.rb:486
108 validates_presence_of :title
Calls
1 ActiveRecord::Validations::ClassMethods#validates_presence_of at vendor/rails/activerecord/lib/active_record/validations.rb:372
109 end
Generated using the rcov code coverage analysis tool for Ruby version 0.6.0.