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 # Extensions for Symbol
5
6 class Symbol
7 unless method_defined?(:to_proc)
8
9 # Turns the symbol into a simple proc, which is especially useful for enumerations. Examples:
10 #
11 # # The same as people.collect { |p| p.name }
12 # people.collect(&:name)
13 #
14 # # The same as people.select { |p| p.manager? }.collect { |p| p.salary }
15 # people.select(&:manager?).collect(&:salary)
16 #
17 # [1, 2, 3].map(&:to_s) # => ['1', '2', '3']
18 # %w[a b c].map(&:to_sym) # => [:a, :b, :c]
19
20 def to_proc
21 Proc.new{|*args| args.shift.__send__(self, *args) }
22 end
23 end
24 end
Generated using the rcov code coverage analysis tool for Ruby version 0.8.1.2.