C0 code coverage information

Generated on Sat Jul 21 11:12:32 -0400 2007 with rcov 0.8.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.
Name Total lines Lines of code Total coverage Code coverage
lib/rools/csv_table.rb 94 50
100.0% 
100.0% 
 1 #require 'rubygems'
 2 #require_gem 'fastercsv'
 3 require 'csv'
 4 require 'rools/base'
 5 
 6 module Rools
 7   
 8   class CsvTable < Base
 9     attr_reader :rules
10   
11     #
12     # return quoted String or Number
13     # There is probably a more elagant way of doing this but...
14     # 
15     def quote( str )
16       return str if (str.to_i.to_s == str)
17       return str if (str.to_f.to_s == str)
18       '"' + str + '"'
19     end
20     
21     def initialize( fileName )
22       csv_data = IO.read( fileName)
23       arrs = []
24       CSV::Reader.parse(csv_data, ",", "\r") do |row|
25         #puts "row:#{row.inspect}"
26         arrs << row
27       end
28       
29       # get rule parameter 
30       parameter = arrs[1][1]
31       #puts "parameter:#{parameter}"
32       
33       # get rule elements Conditions/Consequences
34       rule_elements = arrs[2]
35       
36       # get code
37       rule_code = arrs[3]      
38       
39       # get headers
40       headers = arrs[4]
41       
42       #get number of rules
43       num_rules = arrs.size-5
44       #puts "num rules: #{num_rules}"
45       
46       index   = 0
47       @rules  = ""
48       arrs[5..arrs.size].each { |arr|
49         rule_name = "rule_#{index}"
50         #puts "arr:#{arr} index: #{index}"
51         
52         #if rule_elements[index] != nil
53           @rules << "rule '#{rule_name}' do \n"
54           @rules << "  parameter #{parameter}\n"
55           column = 0
56           
57           rule_elements.each do |element|
58             
59             field  = headers[column].downcase if headers[column]
60             str    = arr[column]
61             
62             if str != nil && element != nil
63               #puts ("eval: #{field} = '#{str}'")
64               #eval( "#{field} = '#{str}'" )
65   
66               @rules << "\t" + element.downcase + "{ "
67               pattern = "\#\{#{field}\}"
68               
69               #puts rule_code[column]
70               #puts "pattern: #{pattern} str:#{str}"
71               if rule_code[column] == pattern
72                 statement = str # straight replace
73               else
74                 statement = rule_code[column].gsub(pattern,quote(str))
75               end
76               
77               #puts "statement:#{statement}"
78               
79               @rules << statement     
80               @rules << "}\n"
81             end
82             
83             column += 1
84           end
85           @rules << "end\n"
86         #end
87         index += 1
88       }
89     end
90   end
91   
92  
93   
94 end

Generated using the rcov code coverage analysis tool for Ruby version 0.8.0.

Valid XHTML 1.0! Valid CSS!