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/default_parameter_proc.rb 74 37
100.0% 
100.0% 
 1 require 'rools/base'
 2 module Rools
 3   
 4   # The DefaultParameterProc binds to a Rule and
 5   # is allows the block to use method_missing to
 6   # refer to the asserted object.
 7   class DefaultParameterProc < Base
 8     
 9     # Determines whether a method is vital to the functionality
10     # of the class.
11     def self.is_vital(method)
12       return method =~ /__(.+)__|method_missing|instance_eval/
13     end
14 
15     # Removes unnecessary methods from the class to minimize
16     # name collisions with method_missing.      
17     for method in instance_methods
18       undef_method(method) unless is_vital(method)
19     end
20     
21     # The "rule" parameter must respond to an :assert method.
22     # The "b" parameter is a block that will be rebound to this
23     # instance.
24     def initialize(rule, b)
25       raise ArgumentError.new('The "rule" parameter must respond to an :assert method') unless rule.respond_to?(:assert)
26       @rule = rule
27       @proc = b
28       #@working_object = nil
29     end
30     
31     # Call the bound block and set the working object so that it
32     # can be referred to by method_missing
33     def call(obj)
34       #@working_object = obj
35       status = instance_eval(&@proc)
36       #@working_object = nil
37       return status
38     end
39     
40     # Assert a new object up the composition-chain into the current RuleSet
41     def assert(obj)
42       @rule.assert(obj)
43     end
44     
45     # Parameterless method calls by the attached block are assumed to
46     # be references to the working object
47     def method_missing(sym, *args)
48       # puts "method missing: #{sym} args:#{args.inspect}"
49       # check if it is a fact first
50       #begin
51         facts = @rule.rule_set.get_facts
52         if facts.has_key?( sym.to_s )
53           #puts "return fact #{facts[sym.to_s].value}" 
54           return facts[sym.to_s].value
55         else
56           raise Exception, "symbol: #{sym} not found in facts"
57         end
58       #rescue Exception => e
59       #  puts "miss exception #{e} #{e.backtrace.join("\n")}"
60       #  return nil
61       #end
62     end
63     
64     # Stops the current assertion. Does not indicate failure.
65     def stop(message = nil)
66       @rule.stop(message)
67     end
68     
69     # Stops the current assertion and change status to :fail
70     def fail(message = nil)
71       @rule.fail(message)
72     end
73   end
74 end

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

Valid XHTML 1.0! Valid CSS!