C0 code coverage information

Generated on Thu Mar 13 11:28:30 -0500 2008 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/methodchain/not_included.rb 67 47
100.0% 
100.0% 
 1 # :main: README
 2 module MethodChain
 3 
 4   def tap meths=nil, &block
 5     send_arguments_as_functions *meths if meths
 6     yield_or_eval(&block) if block_given?
 7     self
 8   end
 9 
10   # method chaining with a guard.
11   # If no guard block is given then guard against nil and false
12   # *methods = [method] where
13   #   method = Message | Code
14   #   Message = Symbol | [Symbol, *arguments]
15   #   Code.to_proc = Proc
16   def chain *meths, &guard
17     return self if meths.empty? or not(
18       (block_given? ? (yield_or_eval(&guard)) : self))
19 
20     (send_as_function (meths.shift)).chain(*meths, &guard)
21   end
22 
23   def send_as_function meth
24     case meth
25     when Symbol then __send__ meth
26     when Array  then __send__(*meth)
27     else             yield_or_eval(&meth)
28     end
29   end
30   private :send_as_function
31 
32   def send_arguments_as_functions *methods
33     methods.each {|meth| send_as_function meth}
34     self
35   end
36 
37   # yield or eval based on the block arity
38   def yield_or_eval &block
39     case block.arity
40     # ruby bug for -1
41     when 0, -1 then instance_eval(&block)
42     when 1     then yield(self)
43     else            raise ArgumentError, "too many arguments required by block"
44     end
45   end
46 
47   # return self if self evaluates to false, otherwise
48   # evaluate the block or return the default argument
49   def then default=nil, &block
50     if self
51       block_given? ? (yield_or_eval(&block)) : (default || (fail \
52         ArgumentError, "#then must be called with an argument or a block"))
53     else
54       self
55     end
56   end
57 
58   # the inverse of then
59   def else arg=nil, &block
60     if self
61       self
62     else
63       block_given? ? (yield_or_eval(&block)) : (arg || (fail \
64         ArgumentError, "#else must be called with an argument or a bloc"))
65     end
66   end
67 end

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

Valid XHTML 1.0! Valid CSS!