C0 code coverage information
Generated on Sat Feb 02 17:44:29 +0100 2008 with rcov 0.8.1.2
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 # Copyright (c) 2008 Michael Fellinger m.fellinger@gmail.com
2 # All files in this distribution are subject to the terms of the Ruby license.
3
4 require File.join(File.dirname(__FILE__), 'blankslate')
5
6 class OrderedSet < BlankSlate
7 def initialize(*args)
8 if args.size == 1
9 @set = args.shift
10 else
11 @set = *args
12 end
13
14 @set ||= []
15 @set = [@set] unless ::Array === @set
16 @set.uniq!
17 end
18
19 def method_missing(meth, *args, &block)
20 case meth.to_s
21 when /push|unshift|\<\</
22 @set.delete *args
23 when '[]='
24 @set.map! do |e|
25 if ::Array === args.last
26 args.last.include?(e) ? nil : e
27 else
28 args.last == e ? nil : e
29 end
30 end
31 end
32 @set.__send__(meth, *args, &block)
33 ensure
34 @set.compact! if meth == :[]=
35 end
36 end
Generated using the rcov code coverage analysis tool for Ruby version 0.8.1.2.