C0 code coverage information
Generated on Fri Aug 25 11:26:28 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 Result
2
3 def self.find(*args)
4 options = extract_options_from_args!(args)
5 conditions = options[:conditions]
6 per_page = options[:limit]
7 offset = options[:offset]
8
9 search_index(conditions)
10 # return only the records for the current page
11 @records[offset...(offset+per_page)]
12 end
13
14 def self.count(conditions = nil, joins = nil)
15 search_index(conditions)
16 @conditions = conditions
17 # return the size of the whole recordset
18 @records.size()
19 end
20
21 # Helper methods
22 def self.search_index(conditions)
23 if (@conditions != conditions)
24 @records = Array.new
25 index = FerretConfig::INDEX
26 # we want 1000 docs returned at max
27 index.search_each(conditions, {:num_docs => 1000}) do |doc, score|
28 @records << index[doc]
29 end
30 end
31 end
32
33 def self.extract_options_from_args!(args)
34 options = args.last.is_a?(Hash) ? args.pop : {}
35 options
36 end
37
38 end
Generated using the rcov code coverage analysis tool for Ruby version 0.7.0.