summaryrefslogtreecommitdiff
path: root/lib/rdoc/ri/ri_writer.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/rdoc/ri/ri_writer.rb')
-rw-r--r--lib/rdoc/ri/ri_writer.rb16
1 files changed, 15 insertions, 1 deletions
diff --git a/lib/rdoc/ri/ri_writer.rb b/lib/rdoc/ri/ri_writer.rb
index 70468cb..78c68e8 100644
--- a/lib/rdoc/ri/ri_writer.rb
+++ b/lib/rdoc/ri/ri_writer.rb
@@ -8,6 +8,19 @@ module RI
end
+ # Convert a name from internal form (containing punctuation)
+ # to an external form (where punctuation is replaced
+ # by %xx)
+
+ def RiWriter.internal_to_external(name)
+ name.gsub(/\W/) { sprintf("%%%02x", $&[0]) }
+ end
+
+ # And the reverse operation
+ def RiWriter.external_to_internal(name)
+ name.gsub(/%([0-9a-f]{2,2})/) { $1.to_i(16).chr }
+ end
+
def initialize(base_dir)
@base_dir = base_dir
end
@@ -27,7 +40,8 @@ module RI
def add_method(class_desc, method_desc)
dir = path_to_dir(class_desc.full_name)
- meth_file_name = File.join(dir, method_desc.name)
+ file_name = RiWriter.internal_to_external(method_desc.name)
+ meth_file_name = File.join(dir, file_name)
if method_desc.is_singleton
meth_file_name += "-c.yaml"
else