diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-11-19 01:08:00 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-11-19 01:08:00 +0000 |
commit | 16ba36042340103b4f079a370238f54c4696bac1 (patch) | |
tree | db0583b55ffcc328736d9c4863f9e44bab3d5a82 /tool | |
parent | 56d8b8701df75d7bd8b0c402c624f38c56385c92 (diff) | |
download | ruby-16ba36042340103b4f079a370238f54c4696bac1.tar.gz |
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')
-rw-r--r-- | tool/vpath.rb | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/tool/vpath.rb b/tool/vpath.rb index 0c8d6071ea..48ab148405 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 |