summaryrefslogtreecommitdiff
path: root/tool/vpath.rb
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-11-19 01:08:00 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-11-19 01:08:00 +0000
commit16ba36042340103b4f079a370238f54c4696bac1 (patch)
treedb0583b55ffcc328736d9c4863f9e44bab3d5a82 /tool/vpath.rb
parent56d8b8701df75d7bd8b0c402c624f38c56385c92 (diff)
prelude.c.tmpl: strip prefix
* template/prelude.c.tmpl (Prelude#translate): strip VPATH prefix from prelude names, so that srcdir diffrences do not make the generated code diffrent. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48490 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'tool/vpath.rb')
-rw-r--r--tool/vpath.rb5
1 files changed, 5 insertions, 0 deletions
diff --git a/tool/vpath.rb b/tool/vpath.rb
index 0c8d607..48ab148 100644
--- a/tool/vpath.rb
+++ b/tool/vpath.rb
@@ -79,4 +79,9 @@ class VPath
end
@list
end
+
+ def strip(path)
+ prefix = list.map {|dir| Regexp.quote(dir)}
+ path.sub(/\A#{prefix.join('|')}(?:\/|\z)/, '')
+ end
end