C0 code coverage information
Generated on Sun Oct 26 11:17:55 -0500 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 require 'aquarium/utils/type_utils'
2
3 module Aquarium
4 module Utils
5 # == NameUtils
6 # Convert various strings, symbols, object ids, etc. into valid "names" that
7 # can be used as method names, etc.
8 module NameUtils
9
10 @@char_expr_map = {
11 '=' => '_equal_',
12 '?' => '_questionmark_',
13 '!' => '_exclamationmark_',
14 '~' => '_tilde_',
15 '-' => '_minus_',
16 '+' => '_plus_',
17 '/' => '_slash_',
18 '*' => '_star_',
19 '<' => '_lessthan_',
20 '>' => '_greaterthan_',
21 '<<' => '_leftshift_',
22 '>>' => '_rightshift_',
23 '=~' => '_matches_',
24 '%' => '_percent_',
25 '^' => '_caret_',
26 '[]' => '_brackets_',
27 '&' => '_ampersand_',
28 '|' => '_pipe_',
29 '`' => '_backtick_'
30 }
31
32 def self.make_type_or_object_key type_or_object
33 if Aquarium::Utils::TypeUtils.is_type?(type_or_object)
34 make_valid_type_name type_or_object
35 else
36 make_valid_object_name type_or_object
37 end
38 end
39
40 def self.make_valid_type_name type
41 type.name.gsub(/:/, '_')
42 end
43
44 def self.make_valid_object_name type_or_object
45 "#{make_valid_type_name(type_or_object.class)}_#{make_valid_object_id_name(type_or_object.object_id)}"
46 end
47
48 # Fixes Tracker #13864.
49 def self.make_valid_object_id_name object_id
50 object_id.to_s.gsub(/^-/, "_neg_")
51 end
52
53 def self.make_valid_attr_name_from_method_name method_name
54 new_name = method_name.to_s
55 @@char_expr_map.keys.sort{|x,y| y.length <=> x.length}.each do |expr|
56 new_name.gsub! expr, @@char_expr_map[expr]
57 end
58 new_name.intern
59 end
60 end
61 end
62 end
Generated using the rcov code coverage analysis tool for Ruby version 0.8.1.2.